[Red5commits] [2247] added more war configs

pgregoire luke at codegent.com
Fri Aug 24 07:40:15 PDT 2007


added more war configs


Timestamp: 08/24/07 09:38:32 EST (less than one hour ago) 
Change: 2247 
Author: pgregoire

Files (see diff or trac for details): 
java/server/trunk/build.xml
java/server/trunk/conf/war/applicationContext.xml
java/server/trunk/conf/war/context.xml
java/server/trunk/conf/war/log4j.properties
java/server/trunk/conf/war/red5-common.xml
java/server/trunk/conf/war/red5-web.properties
java/server/trunk/conf/war/root-context.xml
java/server/trunk/src/org/red5/server/EmbeddableServer.java
java/server/trunk/src/org/red5/server/MainServlet.java
java/server/trunk/src/org/red5/server/Server.java


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

Index: /java/server/trunk/conf/war/context.xml
===================================================================
--- /java/server/trunk/conf/war/context.xml (revision 2244)
+++ /java/server/trunk/conf/war/context.xml (revision 2247)
@@ -14,4 +14,4 @@
     antiJARLocking="false"
 -->
-<Context path="@context.path@">
+<Context path="@context.path@" crossContext="true">
 </Context>
Index: /java/server/trunk/conf/war/red5-common.xml
===================================================================
--- /java/server/trunk/conf/war/red5-common.xml (revision 2232)
+++ /java/server/trunk/conf/war/red5-common.xml (revision 2247)
@@ -4,5 +4,5 @@
 	<!-- This context is shared between all child contexts. -->
 	<!-- Server bean -->
-	<bean id="red5.server" class="org.red5.server.Server"/>
+	<bean id="red5.server" class="org.red5.server.EmbeddableServer"/>
 	<!-- JMX server -->
 	<bean id="jmxFactory" class="org.red5.server.jmx.JMXFactory">
Index: /java/server/trunk/conf/war/root-context.xml
===================================================================
--- /java/server/trunk/conf/war/root-context.xml (revision 2247)
+++ /java/server/trunk/conf/war/root-context.xml (revision 2247)
@@ -0,0 +1,17 @@
+<!--
+Context file for red5 
+
+    http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
+
+    path=""
+    docBase="${catalina.home}/webapps/" 
+    override="true"
+    privileged="true" 
+    reloadable="false"
+    crossContext="false"
+    cookies="false"
+    antiResourceLocking="false" 
+    antiJARLocking="false"
+-->
+<Context path="" crossContext="true" override="true">
+</Context>
Index: /java/server/trunk/conf/war/red5-web.properties
===================================================================
--- /java/server/trunk/conf/war/red5-web.properties (revision 2247)
+++ /java/server/trunk/conf/war/red5-web.properties (revision 2247)
@@ -0,0 +1,2 @@
+webapp.contextPath=@context.path@
+webapp.virtualHosts=*,localhost, localhost:8080, 127.0.0.1:8080
Index: /java/server/trunk/conf/war/applicationContext.xml
===================================================================
--- /java/server/trunk/conf/war/applicationContext.xml (revision 2243)
+++ /java/server/trunk/conf/war/applicationContext.xml (revision 2247)
@@ -7,5 +7,4 @@
 
 	<!-- DEFAULT GLOBAL CONTEXT -->
-	
 	<bean id="global.clientRegistry"
 		class="org.red5.server.ClientRegistry" />
@@ -50,19 +49,3 @@
 	</bean>
 
-	<!-- DEFAULT LOCAL CONTEXT 
-
-	<bean id="web.context" class="org.red5.server.Context"
-		autowire="byType" />
-
-	<bean id="web.scope" class="org.red5.server.WebScope"
-		init-method="register" lazy-init="true">
-		<property name="server" ref="red5.server" />
-		<property name="parent" ref="global.scope" />
-		<property name="context" ref="web.context" />
-		<property name="handler" ref="web.handler" />
-		<property name="contextPath" value="/" />
-		<property name="virtualHosts"
-			value="*,localhost, localhost:5080, 127.0.0.1:5080" />
-	</bean>
--->
 </beans>
Index: /java/server/trunk/conf/war/log4j.properties
===================================================================
--- /java/server/trunk/conf/war/log4j.properties (revision 2136)
+++ /java/server/trunk/conf/war/log4j.properties (revision 2247)
@@ -4,5 +4,5 @@
 log4j.logger.org.red5.server=DEBUG
 log4j.logger.org.red5.server.MainServlet=DEBUG
-log4j.logger.org.red5.server.jmx=DEBUG
+log4j.logger.org.red5.server.jmx=INFO
 log4j.logger.org.red5.server.net.rtmp.status=INFO
 log4j.logger.org.red5.server.net.proxy=INFO
@@ -19,12 +19,9 @@
 log4j.logger.org.red5.server.so=WARN
 log4j.logger.org.red5.server.stream=INFO
-log4j.logger.org.red5.server.stream.consumer=DEBUG
+log4j.logger.org.red5.server.stream.consumer=INFO
 log4j.logger.org.red5.server.script=INFO
 # Apache / Other
-log4j.logger.org.apache.catalina.authenticator=INFO
-log4j.logger.org.apache.catalina.session=INFO
 log4j.logger.httpclient=WARN
 log4j.logger.org.apache.commons.digester=WARN
-log4j.logger.org.apache.jasper=INFO
 log4j.logger.org.apache.commons.httpclient=WARN
 log4j.logger.org.quartz=WARN
@@ -32,8 +29,9 @@
 log4j.logger.org.springframework=INFO
 log4j.logger.org.springframework.beans.factory=INFO
+log4j.logger.org.springframework.beans.factory.support=WARN
 log4j.logger.org.springframework.beans.factory.xml=WARN
 log4j.logger.org.springframework.web.context=INFO
-log4j.logger.org.springframework.web.context.support=WARN
-log4j.logger.org.springframework.ui.context.support=WARN
+#log4j.logger.org.springframework.web.context.support=WARN
+#log4j.logger.org.springframework.ui.context.support=WARN
 # Cache
 log4j.logger.org.red5.server.cache=WARN
Index: /java/server/trunk/src/org/red5/server/MainServlet.java
===================================================================
--- /java/server/trunk/src/org/red5/server/MainServlet.java (revision 2242)
+++ /java/server/trunk/src/org/red5/server/MainServlet.java (revision 2247)
@@ -28,4 +28,6 @@
 import java.util.Properties;
 
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
@@ -63,4 +65,135 @@
 
 	private static ServletContext servletContext;
+
+	/**
+	 * Main entry point for the Red5 Server as a war
+	 */
+	// Notification that the web application is ready to process requests
+	public void contextInitialized(ServletContextEvent sce) {
+		System.setProperty("red5.deployment.type", "war");
+
+//		InitialContext ctx = null;
+//		Server server = null;
+//	    try {
+//			ctx = new InitialContext();
+//			server = (Server) ctx.lookup("red5/server");
+//			logger.info("RED5 JNDI lookup server is null? " + (server == null));
+//	    } catch (NamingException e) {
+//			try {
+//				logger.warn("RED5 JNDI lookup error");
+//				ctx.createSubcontext("red5server");
+//			} catch (NamingException ne) {
+//				logger.warn("RED5 JNDI subcontext creation error", ne);
+//			}
+//		}		
+		
+		if (null != servletContext) {
+			return;
+		}
+		servletContext = sce.getServletContext();
+		String prefix = servletContext.getRealPath("/");
+
+		long time = System.currentTimeMillis();
+
+		logger.info("RED5 Server (http://www.osflash.org/red5)");
+		logger.info("Loading red5 global context from: " + red5Config);
+		logger.info("Path: " + prefix);
+
+		try {
+			// Detect root of Red5 configuration and set as system property
+			String root;
+			String classpath = System.getProperty("java.class.path");
+			File fp = new File(prefix + red5Config);
+			fp = fp.getCanonicalFile();
+			if (!fp.isFile()) {
+				// Given file does not exist, search it on the classpath
+				String[] paths = classpath.split(System
+						.getProperty("path.separator"));
+				for (String element : paths) {
+					fp = new File(element + "/" + red5Config);
+					fp = fp.getCanonicalFile();
+					if (fp.isFile()) {
+						break;
+					}
+				}
+			}
+			if (!fp.isFile()) {
+				throw new Exception("could not find configuration file "
+						+ red5Config + " on your classpath " + classpath);
+			}
+
+			root = fp.getAbsolutePath();
+			root = root.replace('\\', '/');
+			int idx = root.lastIndexOf('/');
+			root = root.substring(0, idx);
+			// update classpath
+			System.setProperty("java.class.path", classpath
+					+ File.pathSeparatorChar + root + File.pathSeparatorChar
+					+ root + "/classes");
+			logger.debug("New classpath: "
+					+ System.getProperty("java.class.path"));
+			// set configuration root
+			System.setProperty("red5.config_root", root);
+			logger.info("Setting configuation root to " + root);
+
+			// Setup system properties so they can be evaluated
+			Properties props = new Properties();
+			props.load(new FileInputStream(root + "/red5.properties"));
+			for (Object o : props.keySet()) {
+				String key = (String) o;
+				if (StringUtils.isNotBlank(key)) {
+					System.setProperty(key, props.getProperty(key));
+				}
+			}
+
+			// Store root directory of Red5
+			idx = root.lastIndexOf('/');
+			root = root.substring(0, idx);
+			if (System.getProperty("file.separator").equals("/")) {
+				// Workaround for linux systems
+				root = "/" + root;
+			}
+			System.setProperty("red5.root", root);
+			logger.info("Setting Red5 root to " + root);
+
+			Class contextClass = org.springframework.web.context.support.XmlWebApplicationContext.class;
+			ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) BeanUtils
+					.instantiateClass(contextClass);
+
+			String[] strArray = servletContext.getInitParameter(
+					ContextLoader.CONFIG_LOCATION_PARAM).split("[,\\s]");
+			logger.info("Config location files: " + strArray.length);
+			applicationContext.setConfigLocations(strArray);
+			applicationContext.setServletContext(servletContext);
+			applicationContext.refresh();
+
+			// set web application context as an attribute of the servlet
+			// context so that it may be located via Springs
+			// WebApplicationContextUtils
+			servletContext
+					.setAttribute(
+							WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
+							applicationContext);
+
+			ConfigurableBeanFactory factory = applicationContext
+					.getBeanFactory();
+			// register default
+			// add the context to the parent
+			factory.registerSingleton("default.context", applicationContext);
+			
+//			if (server == null){	
+//				server = (Server) factory.getBean("red5.server");
+//				ctx.rebind("red5server", server);				
+//			}
+
+		} catch (Throwable e) {
+			logger.error(e);
+		}
+
+		long startupIn = System.currentTimeMillis() - time;
+		logger.info("Startup done in: " + startupIn + " ms");
+
+	}
+
 
 	/**
@@ -115,115 +248,5 @@
 			e.printStackTrace();
 		}
-	}
-
-	/**
-	 * Main entry point for the Red5 Server as a war
-	 */
-	// Notification that the web application is ready to process requests
-	public void contextInitialized(ServletContextEvent sce) {
-		System.setProperty("red5.deployment.type", "war");
-
-		if (null != servletContext) {
-			return;
-		}
-		servletContext = sce.getServletContext();
-		String prefix = servletContext.getRealPath("/");
-
-		long time = System.currentTimeMillis();
-
-		logger.info("RED5 Server (http://www.osflash.org/red5)");
-		logger.info("Loading red5 global context from: " + red5Config);
-		logger.info("Path: " + prefix);
-
-		try {
-			// Detect root of Red5 configuration and set as system property
-			String root;
-			String classpath = System.getProperty("java.class.path");
-			File fp = new File(prefix + red5Config);
-			fp = fp.getCanonicalFile();
-			if (!fp.isFile()) {
-				// Given file does not exist, search it on the classpath
-				String[] paths = classpath.split(System
-						.getProperty("path.separator"));
-				for (String element : paths) {
-					fp = new File(element + "/" + red5Config);
-					fp = fp.getCanonicalFile();
-					if (fp.isFile()) {
-						break;
-					}
-				}
-			}
-			if (!fp.isFile()) {
-				throw new Exception("could not find configuration file "
-						+ red5Config + " on your classpath " + classpath);
-			}
-
-			root = fp.getAbsolutePath();
-			root = root.replace('\\', '/');
-			int idx = root.lastIndexOf('/');
-			root = root.substring(0, idx);
-			// update classpath
-			System.setProperty("java.class.path", classpath
-					+ File.pathSeparatorChar + root + File.pathSeparatorChar
-					+ root + "/classes");
-			logger.debug("New classpath: "
-					+ System.getProperty("java.class.path"));
-			// set configuration root
-			System.setProperty("red5.config_root", root);
-			logger.info("Setting configuation root to " + root);
-
-			// Setup system properties so they can be evaluated
-			Properties props = new Properties();
-			props.load(new FileInputStream(root + "/red5.properties"));
-			for (Object o : props.keySet()) {
-				String key = (String) o;
-				if (StringUtils.isNotBlank(key)) {
-					System.setProperty(key, props.getProperty(key));
-				}
-			}
-
-			// Store root directory of Red5
-			idx = root.lastIndexOf('/');
-			root = root.substring(0, idx);
-			if (System.getProperty("file.separator").equals("/")) {
-				// Workaround for linux systems
-				root = "/" + root;
-			}
-			System.setProperty("red5.root", root);
-			logger.info("Setting Red5 root to " + root);
-
-			Class contextClass = org.springframework.web.context.support.XmlWebApplicationContext.class;
-			ConfigurableWebApplicationContext applicationContext = (ConfigurableWebApplicationContext) BeanUtils
-					.instantiateClass(contextClass);
-
-			String[] strArray = servletContext.getInitParameter(
-					ContextLoader.CONFIG_LOCATION_PARAM).split("[,\\s]");
-			logger.info("Config location files: " + strArray.length);
-			applicationContext.setConfigLocations(strArray);
-			applicationContext.setServletContext(servletContext);
-			applicationContext.refresh();
-
-			// set web application context as an attribute of the servlet
-			// context so that it may be located via Springs
-			// WebApplicationContextUtils
-			servletContext
-					.setAttribute(
-							WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
-							applicationContext);
-
-			ConfigurableBeanFactory factory = applicationContext
-					.getBeanFactory();
-			// register default
-			// add the context to the parent
-			factory.registerSingleton("default.context", applicationContext);
-
-		} catch (Throwable e) {
-			logger.error(e);
-		}
-
-		long startupIn = System.currentTimeMillis() - time;
-		logger.info("Startup done in: " + startupIn + " ms");
-
-	}
-
+	}	
+	
 }
Index: /java/server/trunk/src/org/red5/server/EmbeddableServer.java
===================================================================
--- /java/server/trunk/src/org/red5/server/EmbeddableServer.java (revision 2247)
+++ /java/server/trunk/src/org/red5/server/EmbeddableServer.java (revision 2247)
@@ -0,0 +1,373 @@
+package org.red5.server;
+
+/*
+ * RED5 Open Source Flash Server - http://www.osflash.org/red5
+ * 
+ * Copyright (c) 2006-2007 by respective authors (see below). 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 java.util.Iterator;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.red5.server.api.IConnection;
+import org.red5.server.api.IGlobalScope;
+import org.red5.server.api.IScope;
+import org.red5.server.api.listeners.IConnectionListener;
+import org.red5.server.api.listeners.IScopeListener;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.style.ToStringCreator;
+
+/**
+ * Red5 server core class implementation for use in J2EE archive deployments (war, ear, sar etc).
+ * 
+ * @author The Red5 Project (red5 at osflash.org)
+ * @author Paul Gregoire (mondain at gmail.com)
+ */
+public class EmbeddableServer extends Server {
+
+	// Initialize Logging
+	protected static Log log = LogFactory.getLog(EmbeddableServer.class
+			.getName());
+
+	private static EmbeddableServer instance = null;
+
+	private static InitialContext ctx = null;
+	
+	{
+		try {
+			if (ctx == null) {
+				ctx = new InitialContext();
+			}
+            //test enum code
+            log.debug("Binding list");
+            try {
+                NamingEnumeration enm = ctx.list("");
+                while (enm.hasMore()) {
+                    NameClassPair entry = (NameClassPair) enm.next();
+                    log.debug("Enum entry: " + entry);
+                }
+            } catch (Exception e) {
+                log.debug("Enum Error: " + e.getMessage());
+            }			
+            javax.naming.Context red5Ctx = (javax.naming.Context) ctx.lookup("red5");
+			instance = (EmbeddableServer) red5Ctx.lookup("server");
+			log.info("RED5 JNDI lookup server is null? " + (instance == null));
+		} catch (NamingException e) {
+			try {
+				log.warn("RED5 JNDI lookup error");
+				javax.naming.Context red5Ctx = ctx.createSubcontext("red5");
+				instance = this;
+				red5Ctx.rebind("server", instance);
+			} catch (NamingException ne) {
+				log.warn("RED5 JNDI subcontext creation error", ne);
+			}
+		}
+	}
+
+	private void getInstance() {
+		try {
+			if (ctx == null) {
+				ctx = new InitialContext();
+			}
+            javax.naming.Context red5Ctx = (javax.naming.Context) ctx.lookup("red5");
+			instance = (EmbeddableServer) red5Ctx.lookup("server");
+			log.info("RED5 JNDI lookup server is null? (getInstance)" + (instance == null));
+		} catch (NamingException e) {
+			log.warn("RED5 JNDI lookup error");
+		}
+	}
+
+	/**
+	 * Setter for Spring application context
+	 * 
+	 * @param applicationContext
+	 *            Application context
+	 */
+	@Override
+	public void setApplicationContext(ApplicationContext applicationContext) {
+		if (instance == null) {
+			getInstance();
+		}
+		if (instance.applicationContext == null) {
+			log.debug("Setting application context");
+			instance.applicationContext = applicationContext;
+		} else {
+			log.info("Application context has already been set");
+		}
+	}
+
+	/**
+	 * Does global scope lookup for host name and context path
+	 * 
+	 * @param hostName
+	 *            Host name
+	 * @param contextPath
+	 *            Context path
+	 * @return Global scope
+	 */
+	@Override
+	public IGlobalScope lookupGlobal(String hostName, String contextPath) {
+		// Init mappings key
+		String key = getKey(hostName, contextPath);
+		// If context path contains slashes get complex key and look up for it
+		// in mappings
+		while (contextPath.indexOf(SLASH) != -1) {
+			key = getKey(hostName, contextPath);
+			if (log.isDebugEnabled()) {
+				log.debug("Check: " + key);
+			}
+			if (instance.mapping.containsKey(key)) {
+				return getGlobal(instance.mapping.get(key));
+			}
+			final int slashIndex = contextPath.lastIndexOf(SLASH);
+			// Context path is substring from the beginning and till last slash
+			// index
+			contextPath = contextPath.substring(0, slashIndex);
+		}
+
+		// Get global scope key
+		key = getKey(hostName, contextPath);
+		if (log.isDebugEnabled()) {
+			log.debug("Check host and path: " + key);
+		}
+
+		// Look up for global scope switching keys if still not found
+		if (instance.mapping.containsKey(key)) {
+			return getGlobal(instance.mapping.get(key));
+		}
+		key = getKey(EMPTY, contextPath);
+		if (log.isDebugEnabled()) {
+			log.debug("Check wildcard host with path: " + key);
+		}
+		if (instance.mapping.containsKey(key)) {
+			return getGlobal(instance.mapping.get(key));
+		}
+		key = getKey(hostName, EMPTY);
+		if (log.isDebugEnabled()) {
+			log.debug("Check host with no path: " + key);
+		}
+		if (instance.mapping.containsKey(key)) {
+			return getGlobal(instance.mapping.get(key));
+		}
+		key = getKey(EMPTY, EMPTY);
+		if (log.isDebugEnabled()) {
+			log.debug("Check default host, default path: " + key);
+		}
+		return getGlobal(instance.mapping.get(key));
+	}
+
+	/**
+	 * Return global scope by name
+	 * 
+	 * @param name
+	 *            Global scope name
+	 * @return Global scope
+	 */
+	@Override
+	public IGlobalScope getGlobal(String name) {
+		if (name == null) {
+			return null;
+		}
+		return instance.globals.get(name);
+	}
+
+	/**
+	 * Register global scope
+	 * 
+	 * @param scope
+	 *            Global scope to register
+	 */
+	@Override
+	public void registerGlobal(IGlobalScope scope) {
+		log.info("Registering global scope: " + scope.getName());
+		instance.globals.put(scope.getName(), scope);
+	}
+
+	/**
+	 * Map key (host + / + context path) and global scope name
+	 * 
+	 * @param hostName
+	 *            Host name
+	 * @param contextPath
+	 *            Context path
+	 * @param globalName
+	 *            Global scope name
+	 * @return true if mapping was added, false if already exist
+	 */
+	@Override
+	public boolean addMapping(String hostName, String contextPath,
+			String globalName) {
+		log.info("Add mapping global: " + globalName + " host: " + hostName
+				+ " context: " + contextPath);
+		final String key = getKey(hostName, contextPath);
+		if (log.isDebugEnabled()) {
+			log.debug("Add mapping: " + key + " => " + globalName);
+		}
+		if (instance.mapping.containsKey(key)) {
+			return false;
+		}
+		instance.mapping.put(key, globalName);
+		return true;
+	}
+
+	/**
+	 * Remove mapping with given key
+	 * 
+	 * @param hostName
+	 *            Host name
+	 * @param contextPath
+	 *            Context path
+	 * @return true if mapping was removed, false if key doesn't exist
+	 */
+	@Override
+	public boolean removeMapping(String hostName, String contextPath) {
+		log.info("Remove mapping host: " + hostName + " context: "
+				+ contextPath);
+		final String key = getKey(hostName, contextPath);
+		if (log.isDebugEnabled()) {
+			log.debug("Remove mapping: " + key);
+		}
+		if (!instance.mapping.containsKey(key)) {
+			return false;
+		}
+		instance.mapping.remove(key);
+		return true;
+	}
+
+	/**
+	 * Return mapping
+	 * 
+	 * @return Map of "scope key / scope name" pairs
+	 */
+	@Override
+	public Map<String, String> getMappingTable() {
+		return instance.mapping;
+	}
+
+	/**
+	 * Return global scope names set iterator
+	 * 
+	 * @return Iterator
+	 */
+	@Override
+	public Iterator<String> getGlobalNames() {
+		return instance.globals.keySet().iterator();
+	}
+
+	/**
+	 * Return global scopes set iterator
+	 * 
+	 * @return Iterator
+	 */
+	@Override
+	public Iterator<IGlobalScope> getGlobalScopes() {
+		return instance.globals.values().iterator();
+	}
+
+	/**
+	 * String representation of server
+	 * 
+	 * @return String representation of server
+	 */
+	@Override
+	public String toString() {
+		return new ToStringCreator(this).append(instance.mapping).toString();
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void addListener(IScopeListener listener) {
+		instance.scopeListeners.add(listener);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void addListener(IConnectionListener listener) {
+		instance.connectionListeners.add(listener);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void removeListener(IScopeListener listener) {
+		instance.scopeListeners.remove(listener);
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void removeListener(IConnectionListener listener) {
+		instance.connectionListeners.remove(listener);
+	}
+
+	/**
+	 * Notify listeners about a newly created scope.
+	 * 
+	 * @param scope
+	 *            the scope that was created
+	 */
+	@Override
+	protected void notifyScopeCreated(IScope scope) {
+		for (IScopeListener listener : instance.scopeListeners) {
+			listener.notifyScopeCreated(scope);
+		}
+	}
+
+	/**
+	 * Notify listeners that a scope was removed.
+	 * 
+	 * @param scope
+	 *            the scope that was removed
+	 */
+	@Override
+	protected void notifyScopeRemoved(IScope scope) {
+		for (IScopeListener listener : instance.scopeListeners) {
+			listener.notifyScopeRemoved(scope);
+		}
+	}
+
+	/**
+	 * Notify listeners that a new connection was established.
+	 * 
+	 * @param conn
+	 *            the new connection
+	 */
+	@Override
+	protected void notifyConnected(IConnection conn) {
+		for (IConnectionListener listener : instance.connectionListeners) {
+			listener.notifyConnected(conn);
+		}
+	}
+
+	/**
+	 * Notify listeners that a connection was disconnected.
+	 * 
+	 * @param conn
+	 *            the disconnected connection
+	 */
+	@Override
+	protected void notifyDisconnected(IConnection conn) {
+		for (IConnectionListener listener : instance.

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