[Red5commits] [1044] allow scope handlers to create service handlers dynamically.
jbauch
luke at codegent.com
Tue Jun 27 09:20:11 EDT 2006
allow scope handlers to create service handlers dynamically.
Timestamp: 06/27/06 23:04:08 (less than one hour ago)
Change: 1044
Author: jbauch
Files (see diff or trac for details):
java/server/trunk/src/org/red5/server/service/HandlerServiceResolver.java
java/server/trunk/src/org/red5/server/service/ScopeServiceResolver.java
java/server/trunk/webapps/red5-default.xml
Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1044
Index: /java/server/trunk/webapps/red5-default.xml
===================================================================
--- /java/server/trunk/webapps/red5-default.xml (revision 930)
+++ /java/server/trunk/webapps/red5-default.xml (revision 1044)
@@ -10,4 +10,5 @@
<property name="serviceResolvers">
<list>
+ <bean id="scopeServiceResolver" class="org.red5.server.service.ScopeServiceResolver"/>
<bean id="handlerServiceResolver" class="org.red5.server.service.HandlerServiceResolver"/>
<bean id="contextServiceResolver" class="org.red5.server.service.ContextServiceResolver"/>
Index: /java/server/trunk/src/org/red5/server/service/HandlerServiceResolver.java
===================================================================
--- /java/server/trunk/src/org/red5/server/service/HandlerServiceResolver.java (revision 950)
+++ /java/server/trunk/src/org/red5/server/service/HandlerServiceResolver.java (revision 1044)
@@ -22,12 +22,12 @@
import org.red5.server.api.IScope;
+import org.red5.server.api.IScopeHandler;
import org.red5.server.api.service.IServiceHandlerProvider;
/**
- * Resolves service names in custom configured services.
+ * Allow scope handlers to create service handlers dynamically.
*
* @author The Red5 Project (red5 at osflash.org)
* @author Joachim Bauch (jojo at struktur.de)
- * @see org.red5.server.api.service.IServiceHandlerProvider#registerServiceHandler(String, Object)
*
*/
@@ -35,5 +35,9 @@
public Object resolveService(IScope scope, String serviceName) {
- return scope.getServiceHandler(serviceName);
+ IScopeHandler handler = scope.getHandler();
+ if (handler instanceof IServiceHandlerProvider)
+ return ((IServiceHandlerProvider) handler).getServiceHandler(serviceName);
+
+ return null;
}
Index: /java/server/trunk/src/org/red5/server/service/ScopeServiceResolver.java
===================================================================
--- /java/server/trunk/src/org/red5/server/service/ScopeServiceResolver.java (revision 1044)
+++ /java/server/trunk/src/org/red5/server/service/ScopeServiceResolver.java (revision 1044)
@@ -0,0 +1,39 @@
+package org.red5.server.service;
+
+/*
+ * RED5 Open Source Flash Server - http://www.osflash.org/red5
+ *
+ * Copyright © 2006 by respective authors. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 2.1 of the License, or (at your option) any later
+ * version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+import org.red5.server.api.IScope;
+
+/**
+ * Resolves service names in custom configured services of a scope.
+ *
+ * @author The Red5 Project (red5 at osflash.org)
+ * @author Joachim Bauch (jojo at struktur.de)
+ * @see org.red5.server.api.service.IServiceHandlerProvider#registerServiceHandler(String, Object)
+ *
+ */
+public class ScopeServiceResolver implements IServiceResolver {
+
+ public Object resolveService(IScope scope, String serviceName) {
+ return scope.getServiceHandler(serviceName);
+ }
+
+}
Note:
Diffs are chopped if more than 30k.
This is to get past the limit on the mailing list.
More information about the Red5commits
mailing list