/// <summary>
 /// Initializes the current Destination.
 /// </summary>
 /// <param name="adapterDefinition">Adapter definition.</param>
 public override void Init(AdapterDefinition adapterDefinition)
 {
     //For remoting destinations it is ok to use the default 'dotnet' adapter if no adapter was specified for the service
     if (adapterDefinition == null && this.DestinationDefinition != null && this.DestinationDefinition.Service != null )
         adapterDefinition = this.DestinationDefinition.Service.GetDefaultAdapter();
     base.Init(adapterDefinition);
 }
 /// <summary>
 /// Initializes a new instance of the AdapterRef class.
 /// </summary>
 /// <param name="adapter">The referenced adapter definition.</param>
 public AdapterRef(AdapterDefinition adapter)
 {
     _ref = adapter.Id;
 }
 /// <summary>
 /// Adds a new adapter definition.
 /// </summary>
 /// <param name="adapter">Adapter definition instance.</param>
 public void AddAdapter(AdapterDefinition adapter)
 {
     if (_adapters == null)
         _adapters = new AdapterDefinition[1];
     else
         _adapters = ArrayUtils.Resize(_adapters, _adapters.Length + 1) as AdapterDefinition[];
     _adapters[_adapters.Length - 1] = adapter;
 }
        /// <summary>
        /// Creates a default services configuration instance.
        /// </summary>
        /// <returns>Services configuration instance.</returns>
        public static ServicesConfiguration CreateDefault()
        {
            ServicesConfiguration sc = new ServicesConfiguration();

            LoginCommandCollection loginCommandCollection = FluorineConfiguration.Instance.LoginCommands;
            if (loginCommandCollection != null)
            {
                LoginCommand loginCommand = new LoginCommand();
                loginCommand.Class = loginCommandCollection.GetLoginCommand(LoginCommandSettings.FluorineLoginCommand);
                loginCommand.Server = LoginCommandSettings.FluorineLoginCommand;
                SecurityConfiguration securityConfiguration = new SecurityConfiguration();
                securityConfiguration.LoginCommands = new LoginCommand[] { loginCommand };
                sc.Security = securityConfiguration;
            }

            //Create a default amf channel
            ChannelDefinition channelDefinition = new ChannelDefinition();
            channelDefinition.Class = "flex.messaging.endpoints.AMFEndpoint";
            channelDefinition.Id = "my-amf";
            Endpoint endpoint = new Endpoint();
            endpoint.Url = @"http://{server.name}:{server.port}/{context.root}/Gateway.aspx";
            endpoint.Class = "flex.messaging.endpoints.AMFEndpoint";
            channelDefinition.Endpoint = endpoint;
            sc.Channels = new ChannelDefinition[] { channelDefinition };

            ServiceDefinition serviceDefinition = new ServiceDefinition(sc);
            serviceDefinition.Id = dotFlex.Messaging.Services.RemotingService.RemotingServiceId;
            serviceDefinition.Class = typeof(dotFlex.Messaging.Services.RemotingService).FullName;
            serviceDefinition.MessageTypes = "flex.messaging.messages.RemotingMessage";

            AdapterDefinition adapter = new AdapterDefinition();
            adapter.Id = "dotnet";
            adapter.Class = typeof(dotFlex.Remoting.RemotingAdapter).FullName;
            adapter.Default = true;
            serviceDefinition.AddAdapter(adapter);
            serviceDefinition.Adapters = new AdapterDefinition[] { adapter };
            AdapterRef adapterRef = new AdapterRef();
            adapterRef.Ref = "dotnet";

            DestinationDefinition destination = new DestinationDefinition(serviceDefinition);
            destination.Id = DestinationDefinition.FluorineDestination;
            destination.AdapterRef = adapterRef;
            DestinationProperties properties = new DestinationProperties();
            properties.Source = "*";
            destination.Properties = properties;
            serviceDefinition.AddDestination(destination);

            Services services = new Services();
            services.ServiceDefinitions = new ServiceDefinition[] { serviceDefinition };
            sc.Services = services;

            FlexClient flexClient = new FlexClient();
            sc.FlexClient = flexClient;
            return sc;
        }
Beispiel #5
0
        /// <summary>
        /// Initializes the current Destination.
        /// </summary>
        /// <param name="adapterDefinition">Adapter definition.</param>
        public virtual void Init(AdapterDefinition adapterDefinition)
		{
            if (_initialized)
                throw new NotSupportedException(__Res.GetString(__Res.Destination_Reinit, this.Id, this.GetType().Name));
            _initialized = true;
            if (adapterDefinition != null)
            {
                string typeName = adapterDefinition.Class;
                Type type = ObjectFactory.Locate(typeName);
                if (type != null)
                {
                    _adapter = ObjectFactory.CreateInstance(type) as ServiceAdapter;
                    _adapter.SetDestination(this);
                    _adapter.SetAdapterSettings(adapterDefinition);
                    _adapter.SetDestinationSettings(_destinationDefinition);
                    _adapter.Init();

                }
                else
                    log.Error(__Res.GetString(__Res.Type_InitError, adapterDefinition.Class));
            }
            else
            {
                log.Error(__Res.GetString(__Res.MessageServer_MissingAdapter, this.Id, this.GetType().Name));
            }
            MessageBroker messageBroker = this.Service.GetMessageBroker();
            messageBroker.RegisterDestination(this, _service);

            //If the source has application scope create an instance here, so the service can listen for SessionCreated events for the first request
            if (this.Scope == "application")
            {
                FactoryInstance factoryInstance = GetFactoryInstance();
                object inst = factoryInstance.Lookup();
            }
        }
 internal void SetAdapterSettings(AdapterDefinition value)
 {
     _adapterDefinition = value;
 }
Beispiel #7
0
        /// <summary>
        /// Creates a destination with the specified settings.
        /// </summary>
        /// <param name="destinationDefinition">Destination settings.</param>
        /// <param name="adapterDefinition">Adapter settings.</param>
        /// <returns>The created destination instance.</returns>
        public virtual Destination CreateDestination(DestinationDefinition destinationDefinition, AdapterDefinition adapterDefinition)
		{
			lock(_objLock)
			{
                if (!_destinations.ContainsKey(destinationDefinition.Id))
				{
                    Destination destination = NewDestination(destinationDefinition);
                    destination.Init(adapterDefinition);
                    /*
                    if (destinationDefinition.Adapter != null)
                        destination.Init(destinationSettings.Adapter);
					else
                        destination.Init(_serviceSettings.DefaultAdapter);
                    */
					_destinations[destination.Id] = destination;
					
					string source = destination.DestinationDefinition.Properties.Source;
					//TODO: warn if more then one "*" source occurs.
					if( source != null && source == "*" )
						_defaultDestination = destination;
					return destination;
				}
				else
                    return _destinations[destinationDefinition.Id] as Destination;
			}
		}
Beispiel #8
0
        private void InstallServiceBrowserDestinations(ServiceDefinition service, AdapterDefinition adapter)
        {
            //ServiceBrowser destinations
            DestinationDefinition destination = new DestinationDefinition(service);
            destination.Id = DestinationDefinition.FluorineServiceBrowserDestination;
            destination.Properties.Source = DestinationDefinition.FluorineServiceBrowserDestination;
            destination.AdapterRef = new AdapterRef(adapter);
            service.AddDestination(destination);

            destination = new DestinationDefinition(service);
            destination.Id = DestinationDefinition.FluorineManagementDestination;
            destination.Properties.Source = DestinationDefinition.FluorineManagementDestination;
            destination.AdapterRef = new AdapterRef(adapter);
            service.AddDestination(destination);

            destination = new DestinationDefinition(service);
            destination.Id = DestinationDefinition.FluorineCodeGeneratorDestination;
            destination.Properties.Source = DestinationDefinition.FluorineCodeGeneratorDestination;
            destination.AdapterRef = new AdapterRef(adapter);
            service.AddDestination(destination);

            destination = new DestinationDefinition(service);
            destination.Id = DestinationDefinition.FluorineSqlServiceDestination;
            destination.Properties.Source = DestinationDefinition.FluorineSqlServiceDestination;
            destination.AdapterRef = new AdapterRef(adapter);
            service.AddDestination(destination);
        }