public JsonRpcProxyGenerator(MessageBroker messageBroker)
     : base(messageBroker)
 {
     _generators = new Hashtable();
     _generators.Add("default", new DefaultJsonRpcProxyGenerator());
     try
     {
         JsonRpcGeneratorCollection generatorSettings = FluorineConfiguration.Instance.FluorineSettings.JSonSettings.JsonRpcGenerators;
         for (int i = 0; i < generatorSettings.Count; i++)
         {
             JsonRpcGenerator generatorSetting = generatorSettings[i];
             IJsonRpcProxyGenerator generator = ObjectFactory.CreateInstance(generatorSetting.Type) as IJsonRpcProxyGenerator;
             if (generator != null)
             {
                 _generators.Add(generatorSetting.Name, generator);
             }
             else
             {
                 if (log.IsErrorEnabled)
                     log.Error(string.Format("JsonRpcGenerator {0} was not found", generatorSetting.Name));
             }
         }
     }
     catch (Exception ex)
     {
         log.Fatal("Creating JsonRpcProxyGenerator failed", ex);
     }
 }
Esempio n. 2
0
		//private ILog _coreDumpLog = null;

        public DataService(MessageBroker messageBroker, ServiceDefinition serviceDefinition)
            : base(messageBroker, serviceDefinition)
		{
            /*
			try
			{
				_coreDumpLog = LogManager.GetLogger("FluorineFx.Dump");
			}
			catch{}
            */
		}
Esempio n. 3
0
        /// <summary>
        /// This method supports the Fluorine infrastructure and is not intended to be used directly from your code.
        /// </summary>
		public void Stop()
		{
            lock (SyncRoot)
            {
                if (_messageBroker != null)
                {
                    if (log.IsInfoEnabled)
                        log.Info(__Res.GetString(__Res.MessageServer_Stop));
                    _messageBroker.Stop();
                    _messageBroker = null;
                    if (_policyServer != null)
                    {
                        _policyServer.Close();
                        _policyServer = null;
                    }
                }
            }
		}
        public RemotingService(MessageBroker broker, ServiceDefinition serviceDefinition)
            : base(broker, serviceDefinition)
		{
		}
Esempio n. 5
0
 protected JsonRpcServiceFeature(FluorineFx.Messaging.MessageBroker messageBroker)
 {
     this._messageBroker = messageBroker;
 }
Esempio n. 6
0
        internal ClientManager(MessageBroker messageBroker)
		{
            _messageBroker = messageBroker;
            _clients = new Hashtable();
		}
        public AuthenticationService(MessageBroker broker, ServiceDefinition serviceDefinition)
            : base(broker, serviceDefinition)
		{
		}
Esempio n. 8
0
        /// <summary>
        /// This method supports the Fluorine infrastructure and is not intended to be used directly from your code.
        /// </summary>
        /// <param name="configFolderPaths">Possible configuration file locations.</param>
        /// <param name="serviceBrowserAvailable">Indicates whether the service browser is avaliable.</param>
        public void Init(string[] configFolderPaths, bool serviceBrowserAvailable)
        {
            _messageBroker = new MessageBroker(this);

            string servicesConfigFile = null;

            for (int i = 0; i < configFolderPaths.Length; i++)
            {
                servicesConfigFile = Path.Combine(configFolderPaths[i], "services-config.xml");
                if (log.IsDebugEnabled)
                {
                    log.Debug(__Res.GetString(__Res.MessageServer_TryingServiceConfig, servicesConfigFile));
                }
                if (File.Exists(servicesConfigFile))
                {
                    break;
                }
            }
            if (servicesConfigFile != null && File.Exists(servicesConfigFile))
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug(__Res.GetString(__Res.MessageServer_LoadingServiceConfig, servicesConfigFile));
                }
                _servicesConfiguration = ServicesConfiguration.Load(servicesConfigFile);
            }
            else
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug(__Res.GetString(__Res.MessageServer_LoadingConfigDefault));
                }
                _servicesConfiguration = ServicesConfiguration.CreateDefault();
            }

            foreach (ChannelDefinition channelDefinition in _servicesConfiguration.Channels)
            {
                Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(channelDefinition.Endpoint.Class));
                if (type != null)
                {
                    IEndpoint endpoint = ObjectFactory.CreateInstance(type, new object[] { _messageBroker, channelDefinition }) as IEndpoint;
                    if (endpoint != null)
                    {
                        _messageBroker.AddEndpoint(endpoint);
                    }
                }
                else
                {
                    log.Error(__Res.GetString(__Res.Type_InitError, channelDefinition.Class));
                }
            }
            ChannelDefinition rtmptChannelDefinition = new ChannelDefinition();

            rtmptChannelDefinition.Id = RtmptEndpoint.FluorineRtmptEndpointId;
            IEndpoint rtmptEndpoint = new RtmptEndpoint(_messageBroker, rtmptChannelDefinition);

            _messageBroker.AddEndpoint(rtmptEndpoint);

            if (_servicesConfiguration.Factories != null)
            {
                foreach (Factory factory in _servicesConfiguration.Factories)
                {
                    Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(factory.Class));
                    if (type != null)
                    {
                        IFlexFactory flexFactory = ObjectFactory.CreateInstance(type, new object[0]) as IFlexFactory;
                        if (flexFactory != null)
                        {
                            _messageBroker.AddFactory(factory.Id, flexFactory);
                        }
                    }
                    else
                    {
                        log.Error(__Res.GetString(__Res.Type_InitError, factory.Class));
                    }
                }
            }
            //Add the dotnet Factory
            _messageBroker.AddFactory(DotNetFactory.Id, new DotNetFactory());

            if (serviceBrowserAvailable)
            {
                ServiceDefinition serviceConfiguration = _servicesConfiguration.GetServiceByClass("flex.messaging.services.RemotingService");
                if (serviceConfiguration != null)
                {
                    AdapterDefinition adapter = serviceConfiguration.GetAdapterByClass(typeof(Remoting.RemotingAdapter).FullName);
                    if (adapter != null)
                    {
                        InstallServiceBrowserDestinations(serviceConfiguration, adapter);
                    }
                    else
                    {
                        adapter = serviceConfiguration.GetDefaultAdapter();
                        if (adapter != null)
                        {
                            InstallServiceBrowserDestinations(serviceConfiguration, adapter);
                        }
                    }
                }
            }
            if (_servicesConfiguration.Services.ServiceDefinitions != null)
            {
                foreach (ServiceDefinition serviceDefinition in _servicesConfiguration.Services.ServiceDefinitions)
                {
                    Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(serviceDefinition.Class));//current assembly only
                    if (type != null)
                    {
                        IService service = ObjectFactory.CreateInstance(type, new object[] { _messageBroker, serviceDefinition }) as IService;
                        if (service != null)
                        {
                            _messageBroker.AddService(service);
                        }
                    }
                    else
                    {
                        log.Error(__Res.GetString(__Res.Type_InitError, serviceDefinition.Class));
                    }
                }
            }
            if (_servicesConfiguration.Services.Includes != null)
            {
                foreach (ServiceInclude include in _servicesConfiguration.Services.Includes)
                {
                    ServiceDefinition serviceDefinition = include.ServiceDefinition;
                    Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(serviceDefinition.Class));//current assembly only
                    if (type != null)
                    {
                        IService service = ObjectFactory.CreateInstance(type, new object[] { _messageBroker, serviceDefinition }) as IService;
                        if (service != null)
                        {
                            _messageBroker.AddService(service);
                        }
                    }
                    else
                    {
                        log.Error(__Res.GetString(__Res.Type_InitError, serviceDefinition.Class));
                    }
                }
            }
            if (_servicesConfiguration.Security != null)
            {
                if (_servicesConfiguration.Security.LoginCommands != null && _servicesConfiguration.Security.LoginCommands.Length > 0)
                {
                    LoginCommand loginCommand = _servicesConfiguration.Security.GetLoginCommand(LoginCommand.FluorineLoginCommand);
                    if (loginCommand != null)
                    {
                        Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(loginCommand.Class));
                        if (type != null)
                        {
                            ILoginCommand loginCommandObj = ObjectFactory.CreateInstance(type, new object[] { }) as ILoginCommand;
                            _messageBroker.LoginManager.LoginCommand = loginCommandObj;
                            _messageBroker.LoginManager.IsPerClientAuthentication = loginCommand.IsPerClientAuthentication;
                        }
                        else
                        {
                            log.Error(__Res.GetString(__Res.Type_InitError, loginCommand.Class));
                        }
                    }
                    else
                    {
                        log.Error(__Res.GetString(__Res.Type_InitError, "<<LoginCommand class>>"));
                    }
                }
            }
            InitAuthenticationService();

            try
            {
                if (FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings != null &&
                    FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.Enable)
                {
                    IResource resource;
                    if (FluorineContext.Current != null)
                    {
                        resource = FluorineContext.Current.GetResource(FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.PolicyFile);
                    }
                    else
                    {
                        resource = new FileSystemResource(FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.PolicyFile);
                    }
                    if (resource.Exists)
                    {
                        log.Info(__Res.GetString(__Res.Silverlight_StartPS, resource.File.FullName));
                        _policyServer = new PolicyServer(resource.File.FullName);
                    }
                    else
                    {
                        throw new FileNotFoundException("Policy file not found", FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.PolicyFile);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(__Res.GetString(__Res.Silverlight_PSError), ex);
            }
        }
Esempio n. 9
0
        public RtmpEndpoint(MessageBroker messageBroker, ChannelDefinition channelDefinition)
            : base(messageBroker, channelDefinition)
		{
        }
Esempio n. 10
0
 protected JsonRpcServiceFeature(MessageBroker messageBroker)
 {
     _messageBroker = messageBroker;
 }
Esempio n. 11
0
        public AMFEndpoint(MessageBroker messageBroker, ChannelDefinition channelDefinition)
            : base(messageBroker, channelDefinition)
		{
            _waitingPollRequests = new AtomicInteger();
		}
Esempio n. 12
0
 public JsonRpcExecutive(MessageBroker messageBroker)
     : base(messageBroker)
 {
 }
Esempio n. 13
0
        internal SessionManager(MessageBroker messageBroker)
		{
            _messageBroker = messageBroker;
            _sessions = new Hashtable();
		}
Esempio n. 14
0
        /// <summary>
        /// This method supports the Fluorine infrastructure and is not intended to be used directly from your code.
        /// </summary>
        /// <param name="configFolderPaths">Possible configuration file locations.</param>
        /// <param name="serviceBrowserAvailable">Indicates whether the service browser is avaliable.</param>
        public void Init(string[] configFolderPaths, bool serviceBrowserAvailable)
		{
			_messageBroker = new MessageBroker(this);

            string servicesConfigFile = null;
            for (int i = 0; i < configFolderPaths.Length; i++)
            {
                servicesConfigFile = Path.Combine(configFolderPaths[i], "services-config.xml");
                if (log.IsDebugEnabled)
                    log.Debug(__Res.GetString(__Res.MessageServer_TryingServiceConfig, servicesConfigFile));
                if (File.Exists(servicesConfigFile))
                    break;
            }
            if (servicesConfigFile != null && File.Exists(servicesConfigFile))
            {
                if (log.IsDebugEnabled)
                    log.Debug(__Res.GetString(__Res.MessageServer_LoadingServiceConfig, servicesConfigFile));
                _servicesConfiguration = ServicesConfiguration.Load(servicesConfigFile);
            }
            else
            {
                if (log.IsDebugEnabled)
                    log.Debug(__Res.GetString(__Res.MessageServer_LoadingConfigDefault));
                _servicesConfiguration = ServicesConfiguration.CreateDefault();
            }

            foreach (ChannelDefinition channelDefinition in _servicesConfiguration.Channels)
            {
                Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(channelDefinition.Endpoint.Class));
                if (type != null)
                {
                    IEndpoint endpoint = ObjectFactory.CreateInstance(type, new object[] { _messageBroker, channelDefinition }) as IEndpoint;
                    if (endpoint != null)
                        _messageBroker.AddEndpoint(endpoint);
                }
                else
                    log.Error(__Res.GetString(__Res.Type_InitError, channelDefinition.Class));
            }
            ChannelDefinition rtmptChannelDefinition = new ChannelDefinition();
            rtmptChannelDefinition.Id = RtmptEndpoint.FluorineRtmptEndpointId;
            IEndpoint rtmptEndpoint = new RtmptEndpoint(_messageBroker, rtmptChannelDefinition);
            _messageBroker.AddEndpoint(rtmptEndpoint);

            if (_servicesConfiguration.Factories != null)
            {
                foreach (Factory factory in _servicesConfiguration.Factories)
                {
                    Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(factory.Class));
                    if (type != null)
                    {
                        IFlexFactory flexFactory = ObjectFactory.CreateInstance(type, new object[0]) as IFlexFactory;
                        if (flexFactory != null)
                            _messageBroker.AddFactory(factory.Id, flexFactory);
                    }
                    else
                        log.Error(__Res.GetString(__Res.Type_InitError, factory.Class));
                }
            }
            //Add the dotnet Factory
            _messageBroker.AddFactory(DotNetFactory.Id, new DotNetFactory());
            
            if (serviceBrowserAvailable)
            {
                ServiceDefinition serviceConfiguration = _servicesConfiguration.GetServiceByClass("flex.messaging.services.RemotingService");
                if (serviceConfiguration != null)
                {
                    AdapterDefinition adapter = serviceConfiguration.GetAdapterByClass(typeof(Remoting.RemotingAdapter).FullName);
                    if (adapter != null)
                        InstallServiceBrowserDestinations(serviceConfiguration, adapter);
                    else
                    {
                        adapter = serviceConfiguration.GetDefaultAdapter();
                        if (adapter != null)
                            InstallServiceBrowserDestinations(serviceConfiguration, adapter);
                    }
                }
            }
            if (_servicesConfiguration.Services.ServiceDefinitions != null)
            {
                foreach (ServiceDefinition serviceDefinition in _servicesConfiguration.Services.ServiceDefinitions)
                {
                    Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(serviceDefinition.Class));//current assembly only
                    if (type != null)
                    {
                        IService service = ObjectFactory.CreateInstance(type, new object[] { _messageBroker, serviceDefinition }) as IService;
                        if (service != null)
                            _messageBroker.AddService(service);
                    }
                    else
                        log.Error(__Res.GetString(__Res.Type_InitError, serviceDefinition.Class));
                }
            }
            if (_servicesConfiguration.Services.Includes != null)
            {
                foreach (ServiceInclude include in _servicesConfiguration.Services.Includes)
                {
                    ServiceDefinition serviceDefinition = include.ServiceDefinition;
                    Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(serviceDefinition.Class));//current assembly only
                    if (type != null)
                    {
                        IService service = ObjectFactory.CreateInstance(type, new object[] { _messageBroker, serviceDefinition }) as IService;
                        if (service != null)
                            _messageBroker.AddService(service);
                    }
                    else
                        log.Error(__Res.GetString(__Res.Type_InitError, serviceDefinition.Class));
                }
            }
            if (_servicesConfiguration.Security != null)
            {
                if (_servicesConfiguration.Security.LoginCommands != null && _servicesConfiguration.Security.LoginCommands.Length > 0)
                {
                    LoginCommand loginCommand = _servicesConfiguration.Security.GetLoginCommand(LoginCommand.FluorineLoginCommand);
                    if (loginCommand != null)
                    {
                        Type type = ObjectFactory.Locate(FluorineConfiguration.Instance.ClassMappings.GetType(loginCommand.Class));
                        if (type != null)
                        {
                            ILoginCommand loginCommandObj = ObjectFactory.CreateInstance(type, new object[] { }) as ILoginCommand;
                            _messageBroker.LoginManager.LoginCommand = loginCommandObj;
                            _messageBroker.LoginManager.IsPerClientAuthentication = loginCommand.IsPerClientAuthentication;
                        }
                        else
                            log.Error(__Res.GetString(__Res.Type_InitError, loginCommand.Class));
                    }
                    else
                        log.Error(__Res.GetString(__Res.Type_InitError, "<<LoginCommand class>>"));
                }
            }
            InitAuthenticationService();

            try
            {
                if (FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings != null &&
                    FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.Enable)
                {
                    IResource resource;
                    if (FluorineContext.Current != null)
                        resource = FluorineContext.Current.GetResource(FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.PolicyFile);
                    else
                        resource = new FileSystemResource(FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.PolicyFile);
                    if (resource.Exists)
                    {
                        log.Info(__Res.GetString(__Res.Silverlight_StartPS, resource.File.FullName));
                        _policyServer = new PolicyServer(resource.File.FullName);
                    }
                    else
                        throw new FileNotFoundException("Policy file not found", FluorineConfiguration.Instance.FluorineSettings.Silverlight.PolicyServerSettings.PolicyFile);
                }
            }
            catch (Exception ex)
            {
                log.Error(__Res.GetString(__Res.Silverlight_PSError), ex);
            }
		}
Esempio n. 15
0
        public StreamingAmfEndpoint(MessageBroker messageBroker, ChannelDefinition channelDefinition)
            : base(messageBroker, channelDefinition)
		{
            _streamingClientsCount = new AtomicInteger();
		}
Esempio n. 16
0
        public EndpointBase(MessageBroker messageBroker, ChannelDefinition channelDefinition)
		{
			_messageBroker = messageBroker;
            _channelDefinition = channelDefinition;
		}
Esempio n. 17
0
 internal ClientManager(MessageBroker messageBroker)
 {
     _messageBroker = messageBroker;
     _clients       = new Hashtable();
 }