@Test public void testInit() { System.out.println("Not yet implemented"); }
public void init() { HashMap<String, Object> env = null; if (enableRmiAdapter) { log.debug("Create an RMI connector server"); System.setProperty("java.rmi.server.hostname", rmiAdapterHost); try { Registry r = null; try { r = LocateRegistry.getRegistry(Integer .valueOf(rmiAdapterPort)); for (String regName : r.list()) { if (regName.equals("red5")) { r.unbind("red5"); } } } catch (RemoteException re) { log.info("RMI Registry server was not found on port " + rmiAdapterPort); if (startRegistry) { log.info("Starting an internal RMI registry"); r = LocateRegistry.createRegistry(Integer .valueOf(rmiAdapterPort)); } } JMXServiceURL url = null; if (StringUtils.isNotEmpty(rmiAdapterRemotePort)) { url = new JMXServiceURL("service:jmx:rmi: + rmiAdapterHost + ":" + rmiAdapterRemotePort + "/jndi/rmi: } else { url = new JMXServiceURL( "service:jmx:rmi: + "/red5"); } log.info("JMXServiceUrl is: {}", url); if (enableSsl) { System.setProperty("javax.net.ssl.keyStore", remoteSSLKeystore); System.setProperty("javax.net.ssl.keyStorePassword", remoteSSLKeystorePass); log.debug("Initialize the environment map"); env = new HashMap<String, Object>(); SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory(); SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory(); env .put( RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf); env .put( RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf); } if (StringUtils.isNotBlank(remoteAccessProperties)) { if (null == env) { env = new HashMap<String, Object>(); } File file = new File(remoteAccessProperties); if (!file.exists() && remoteAccessProperties.indexOf(System.getProperty("red5.config_root")) != 0) { log.debug("Access file was not found on path, will prepend config_root"); remoteAccessProperties = System .getProperty("red5.config_root") + '/' + remoteAccessProperties; remotePasswordProperties = System .getProperty("red5.config_root") + '/' + remotePasswordProperties; } env.put("jmx.remote.x.access.file", remoteAccessProperties); env.put("jmx.remote.x.password.file", remotePasswordProperties); } cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); cs.addNotificationListener(this, null, null); log.debug("Start the RMI connector server"); cs.start(); log.info("JMX RMI connector server successfully started"); } catch (ConnectException e) { log .warn("Could not establish RMI connection to port " + rmiAdapterPort + ", please make sure \"rmiregistry\" is running and configured to listen on this port."); } catch (IOException e) { String errMsg = e.getMessage(); if (errMsg.indexOf("NameAlreadyBoundException") != -1) { log .error("JMX connector (red5) already registered, you will need to restart your rmiregistry"); } else { log.error("{}", e); } } catch (Exception e) { log.error("Error in setup of JMX subsystem (RMI connector)", e); } } else { log.info("JMX RMI adapter was not enabled"); } }
JMXAgent implements NotificationListener { public void init() { HashMap<String, Object> env = null; if (enableRmiAdapter) { log.debug("Create an RMI connector server"); System.setProperty("java.rmi.server.hostname", rmiAdapterHost); try { Registry r = null; try { r = LocateRegistry.getRegistry(Integer .valueOf(rmiAdapterPort)); for (String regName : r.list()) { if (regName.equals("red5")) { r.unbind("red5"); } } } catch (RemoteException re) { log.info("RMI Registry server was not found on port " + rmiAdapterPort); if (startRegistry) { log.info("Starting an internal RMI registry"); r = LocateRegistry.createRegistry(Integer .valueOf(rmiAdapterPort)); } } JMXServiceURL url = null; if (StringUtils.isNotEmpty(rmiAdapterRemotePort)) { url = new JMXServiceURL("service:jmx:rmi: + rmiAdapterHost + ":" + rmiAdapterRemotePort + "/jndi/rmi: } else { url = new JMXServiceURL( "service:jmx:rmi: + "/red5"); } log.info("JMXServiceUrl is: {}", url); if (enableSsl) { System.setProperty("javax.net.ssl.keyStore", remoteSSLKeystore); System.setProperty("javax.net.ssl.keyStorePassword", remoteSSLKeystorePass); log.debug("Initialize the environment map"); env = new HashMap<String, Object>(); SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory(); SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory(); env .put( RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf); env .put( RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf); } if (StringUtils.isNotBlank(remoteAccessProperties)) { if (null == env) { env = new HashMap<String, Object>(); } File file = new File(remoteAccessProperties); if (!file.exists() && remoteAccessProperties.indexOf(System.getProperty("red5.config_root")) != 0) { log.debug("Access file was not found on path, will prepend config_root"); remoteAccessProperties = System .getProperty("red5.config_root") + '/' + remoteAccessProperties; remotePasswordProperties = System .getProperty("red5.config_root") + '/' + remotePasswordProperties; } env.put("jmx.remote.x.access.file", remoteAccessProperties); env.put("jmx.remote.x.password.file", remotePasswordProperties); } cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); cs.addNotificationListener(this, null, null); log.debug("Start the RMI connector server"); cs.start(); log.info("JMX RMI connector server successfully started"); } catch (ConnectException e) { log .warn("Could not establish RMI connection to port " + rmiAdapterPort + ", please make sure \"rmiregistry\" is running and configured to listen on this port."); } catch (IOException e) { String errMsg = e.getMessage(); if (errMsg.indexOf("NameAlreadyBoundException") != -1) { log .error("JMX connector (red5) already registered, you will need to restart your rmiregistry"); } else { log.error("{}", e); } } catch (Exception e) { log.error("Error in setup of JMX subsystem (RMI connector)", e); } } else { log.info("JMX RMI adapter was not enabled"); } } }
JMXAgent implements NotificationListener { public void init() { HashMap<String, Object> env = null; if (enableRmiAdapter) { log.debug("Create an RMI connector server"); System.setProperty("java.rmi.server.hostname", rmiAdapterHost); try { Registry r = null; try { r = LocateRegistry.getRegistry(Integer .valueOf(rmiAdapterPort)); for (String regName : r.list()) { if (regName.equals("red5")) { r.unbind("red5"); } } } catch (RemoteException re) { log.info("RMI Registry server was not found on port " + rmiAdapterPort); if (startRegistry) { log.info("Starting an internal RMI registry"); r = LocateRegistry.createRegistry(Integer .valueOf(rmiAdapterPort)); } } JMXServiceURL url = null; if (StringUtils.isNotEmpty(rmiAdapterRemotePort)) { url = new JMXServiceURL("service:jmx:rmi: + rmiAdapterHost + ":" + rmiAdapterRemotePort + "/jndi/rmi: } else { url = new JMXServiceURL( "service:jmx:rmi: + "/red5"); } log.info("JMXServiceUrl is: {}", url); if (enableSsl) { System.setProperty("javax.net.ssl.keyStore", remoteSSLKeystore); System.setProperty("javax.net.ssl.keyStorePassword", remoteSSLKeystorePass); log.debug("Initialize the environment map"); env = new HashMap<String, Object>(); SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory(); SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory(); env .put( RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf); env .put( RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf); } if (StringUtils.isNotBlank(remoteAccessProperties)) { if (null == env) { env = new HashMap<String, Object>(); } File file = new File(remoteAccessProperties); if (!file.exists() && remoteAccessProperties.indexOf(System.getProperty("red5.config_root")) != 0) { log.debug("Access file was not found on path, will prepend config_root"); remoteAccessProperties = System .getProperty("red5.config_root") + '/' + remoteAccessProperties; remotePasswordProperties = System .getProperty("red5.config_root") + '/' + remotePasswordProperties; } env.put("jmx.remote.x.access.file", remoteAccessProperties); env.put("jmx.remote.x.password.file", remotePasswordProperties); } cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); cs.addNotificationListener(this, null, null); log.debug("Start the RMI connector server"); cs.start(); log.info("JMX RMI connector server successfully started"); } catch (ConnectException e) { log .warn("Could not establish RMI connection to port " + rmiAdapterPort + ", please make sure \"rmiregistry\" is running and configured to listen on this port."); } catch (IOException e) { String errMsg = e.getMessage(); if (errMsg.indexOf("NameAlreadyBoundException") != -1) { log .error("JMX connector (red5) already registered, you will need to restart your rmiregistry"); } else { log.error("{}", e); } } catch (Exception e) { log.error("Error in setup of JMX subsystem (RMI connector)", e); } } else { log.info("JMX RMI adapter was not enabled"); } }  }
JMXAgent implements NotificationListener { public void init() { HashMap<String, Object> env = null; if (enableRmiAdapter) { log.debug("Create an RMI connector server"); System.setProperty("java.rmi.server.hostname", rmiAdapterHost); try { Registry r = null; try { r = LocateRegistry.getRegistry(Integer .valueOf(rmiAdapterPort)); for (String regName : r.list()) { if (regName.equals("red5")) { r.unbind("red5"); } } } catch (RemoteException re) { log.info("RMI Registry server was not found on port " + rmiAdapterPort); if (startRegistry) { log.info("Starting an internal RMI registry"); r = LocateRegistry.createRegistry(Integer .valueOf(rmiAdapterPort)); } } JMXServiceURL url = null; if (StringUtils.isNotEmpty(rmiAdapterRemotePort)) { url = new JMXServiceURL("service:jmx:rmi: + rmiAdapterHost + ":" + rmiAdapterRemotePort + "/jndi/rmi: } else { url = new JMXServiceURL( "service:jmx:rmi: + "/red5"); } log.info("JMXServiceUrl is: {}", url); if (enableSsl) { System.setProperty("javax.net.ssl.keyStore", remoteSSLKeystore); System.setProperty("javax.net.ssl.keyStorePassword", remoteSSLKeystorePass); log.debug("Initialize the environment map"); env = new HashMap<String, Object>(); SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory(); SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory(); env .put( RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf); env .put( RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf); } if (StringUtils.isNotBlank(remoteAccessProperties)) { if (null == env) { env = new HashMap<String, Object>(); } File file = new File(remoteAccessProperties); if (!file.exists() && remoteAccessProperties.indexOf(System.getProperty("red5.config_root")) != 0) { log.debug("Access file was not found on path, will prepend config_root"); remoteAccessProperties = System .getProperty("red5.config_root") + '/' + remoteAccessProperties; remotePasswordProperties = System .getProperty("red5.config_root") + '/' + remotePasswordProperties; } env.put("jmx.remote.x.access.file", remoteAccessProperties); env.put("jmx.remote.x.password.file", remotePasswordProperties); } cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); cs.addNotificationListener(this, null, null); log.debug("Start the RMI connector server"); cs.start(); log.info("JMX RMI connector server successfully started"); } catch (ConnectException e) { log .warn("Could not establish RMI connection to port " + rmiAdapterPort + ", please make sure \"rmiregistry\" is running and configured to listen on this port."); } catch (IOException e) { String errMsg = e.getMessage(); if (errMsg.indexOf("NameAlreadyBoundException") != -1) { log .error("JMX connector (red5) already registered, you will need to restart your rmiregistry"); } else { log.error("{}", e); } } catch (Exception e) { log.error("Error in setup of JMX subsystem (RMI connector)", e); } } else { log.info("JMX RMI adapter was not enabled"); } }  static String trimClassName(String className); @SuppressWarnings("unchecked") static boolean registerMBean(Object instance, String className,
			Class interfaceClass); @SuppressWarnings("unchecked") static boolean registerMBean(Object instance, String className,
			Class interfaceClass, ObjectName name); @SuppressWarnings("unchecked") static boolean registerMBean(Object instance, String className,
			Class interfaceClass, String name); static void shutdown(); static boolean unregisterMBean(ObjectName oName); static boolean updateMBeanAttribute(ObjectName oName, String key,
			int value); static boolean updateMBeanAttribute(ObjectName oName, String key,
			String value); void handleNotification(Notification notification, Object handback); void init(); void setEnableRmiAdapter(boolean enableRmiAdapter); void setEnableRmiAdapter(String enableRmiAdapterString); void setEnableSsl(boolean enableSsl); void setEnableSsl(String enableSslString); void setRemoteAccessProperties(String remoteAccessProperties); void setRemotePasswordProperties(String remotePasswordProperties); void setRemoteSSLKeystore(String remoteSSLKeystore); void setRemoteSSLKeystorePass(String remoteSSLKeystorePass); void setRmiAdapterRemotePort(String rmiAdapterRemotePort); void setRmiAdapterPort(String rmiAdapterPort); void setRmiAdapterHost(String rmiAdapterHost); void setStartRegistry(boolean startRegistry); void setEnableMinaMonitor(boolean enableMinaMonitor); void setEnableMinaMonitor(String enableMinaMonitor); static boolean isEnableMinaMonitor(); }
JMXAgent implements NotificationListener { public void init() { HashMap<String, Object> env = null; if (enableRmiAdapter) { log.debug("Create an RMI connector server"); System.setProperty("java.rmi.server.hostname", rmiAdapterHost); try { Registry r = null; try { r = LocateRegistry.getRegistry(Integer .valueOf(rmiAdapterPort)); for (String regName : r.list()) { if (regName.equals("red5")) { r.unbind("red5"); } } } catch (RemoteException re) { log.info("RMI Registry server was not found on port " + rmiAdapterPort); if (startRegistry) { log.info("Starting an internal RMI registry"); r = LocateRegistry.createRegistry(Integer .valueOf(rmiAdapterPort)); } } JMXServiceURL url = null; if (StringUtils.isNotEmpty(rmiAdapterRemotePort)) { url = new JMXServiceURL("service:jmx:rmi: + rmiAdapterHost + ":" + rmiAdapterRemotePort + "/jndi/rmi: } else { url = new JMXServiceURL( "service:jmx:rmi: + "/red5"); } log.info("JMXServiceUrl is: {}", url); if (enableSsl) { System.setProperty("javax.net.ssl.keyStore", remoteSSLKeystore); System.setProperty("javax.net.ssl.keyStorePassword", remoteSSLKeystorePass); log.debug("Initialize the environment map"); env = new HashMap<String, Object>(); SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory(); SslRMIServerSocketFactory ssf = new SslRMIServerSocketFactory(); env .put( RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf); env .put( RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf); } if (StringUtils.isNotBlank(remoteAccessProperties)) { if (null == env) { env = new HashMap<String, Object>(); } File file = new File(remoteAccessProperties); if (!file.exists() && remoteAccessProperties.indexOf(System.getProperty("red5.config_root")) != 0) { log.debug("Access file was not found on path, will prepend config_root"); remoteAccessProperties = System .getProperty("red5.config_root") + '/' + remoteAccessProperties; remotePasswordProperties = System .getProperty("red5.config_root") + '/' + remotePasswordProperties; } env.put("jmx.remote.x.access.file", remoteAccessProperties); env.put("jmx.remote.x.password.file", remotePasswordProperties); } cs = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); cs.addNotificationListener(this, null, null); log.debug("Start the RMI connector server"); cs.start(); log.info("JMX RMI connector server successfully started"); } catch (ConnectException e) { log .warn("Could not establish RMI connection to port " + rmiAdapterPort + ", please make sure \"rmiregistry\" is running and configured to listen on this port."); } catch (IOException e) { String errMsg = e.getMessage(); if (errMsg.indexOf("NameAlreadyBoundException") != -1) { log .error("JMX connector (red5) already registered, you will need to restart your rmiregistry"); } else { log.error("{}", e); } } catch (Exception e) { log.error("Error in setup of JMX subsystem (RMI connector)", e); } } else { log.info("JMX RMI adapter was not enabled"); } }  static String trimClassName(String className); @SuppressWarnings("unchecked") static boolean registerMBean(Object instance, String className,
			Class interfaceClass); @SuppressWarnings("unchecked") static boolean registerMBean(Object instance, String className,
			Class interfaceClass, ObjectName name); @SuppressWarnings("unchecked") static boolean registerMBean(Object instance, String className,
			Class interfaceClass, String name); static void shutdown(); static boolean unregisterMBean(ObjectName oName); static boolean updateMBeanAttribute(ObjectName oName, String key,
			int value); static boolean updateMBeanAttribute(ObjectName oName, String key,
			String value); void handleNotification(Notification notification, Object handback); void init(); void setEnableRmiAdapter(boolean enableRmiAdapter); void setEnableRmiAdapter(String enableRmiAdapterString); void setEnableSsl(boolean enableSsl); void setEnableSsl(String enableSslString); void setRemoteAccessProperties(String remoteAccessProperties); void setRemotePasswordProperties(String remotePasswordProperties); void setRemoteSSLKeystore(String remoteSSLKeystore); void setRemoteSSLKeystorePass(String remoteSSLKeystorePass); void setRmiAdapterRemotePort(String rmiAdapterRemotePort); void setRmiAdapterPort(String rmiAdapterPort); void setRmiAdapterHost(String rmiAdapterHost); void setStartRegistry(boolean startRegistry); void setEnableMinaMonitor(boolean enableMinaMonitor); void setEnableMinaMonitor(String enableMinaMonitor); static boolean isEnableMinaMonitor();  }