public ConfigurationStore(IZipper zipper, IDeserializer deserializer, ISerializer serializer, IDialog dialog)
 {
     _zipper = zipper;
     _deserializer = deserializer;
     _serializer = serializer;
     _dialog = dialog;
 }
        public GetDatabaseResponseFactory(ISerializer serializer)
        {
            Ensure.That(serializer, "serializer").IsNotNull();

            SuccessfulResponseMaterializer = new SimpleDeserializingResponseMaterializer(serializer);
            FailedResponseMaterializer = new FailedResponseMaterializer(serializer);
        }
 public MessageHandler(IKernel kernel, ITransport transport, ISerializer serializer, TimeoutManager timeoutManager)
 {
     m_kernel = kernel;
     m_transport = transport;
     m_serializer = serializer;
     m_timeoutManager = timeoutManager;
 }
Exemple #4
0
     public WorkerEngine(ISerializer serializer, IHandler handler, string loadbalancerAddress)
     {
         m_serializer = serializer;
         m_loadbalancerAddress = loadbalancerAddress;
         m_handler = handler;
         m_nextMessageId = 0;
 }
 public DefaultEndpointCircuitBreaker(IPipelineTransport transport, ISerializer serializer, EndpointDefinition definitioin)
 {
     this.ErrorStrategy = new EndpointPostConsumeStrategy.ErrorEndpointPerEndpoint(transport, serializer, definitioin);
     this.RetryStrategy = new EndpointPostConsumeStrategy.RetryEndpointPerEndpoint(transport, serializer, definitioin);
     this.SuccessStrategy = new EndpointPostConsumeStrategy.NoSuccessStrategy();
     this.MaximumMessageAge = 5;
 }
        public void SetUp()
        {
            var configuration = new ConnectionConfiguration
            {
                Hosts = new List<IHostConfiguration>
                {
                    new HostConfiguration { Host = "localhost", Port = 5672 }
                },
                UserName = "******",
                Password = "******"
            };

            configuration.Validate();

            var typeNameSerializer = new TypeNameSerializer();
            connectionFactory = new ConnectionFactoryWrapper(configuration, new DefaultClusterHostSelectionStrategy<ConnectionFactoryInfo>());
            serializer = new JsonSerializer(typeNameSerializer);
            conventions = new Conventions(typeNameSerializer);
            consumerErrorStrategy = new DefaultConsumerErrorStrategy(
                connectionFactory, 
                serializer, 
                new ConsoleLogger(), 
                conventions,
                typeNameSerializer);
         
        }
 internal ConsumedMessage ToConsumedMessage(ISerializer serializer, MessageBinding messageBinding)
 {
     return new ConsumedMessage(serializer.Deserialize(_args.Body,
                                                       messageBinding.RuntimeType,
                                                       _args.BasicProperties.CreateEncoding()),
                                _args);
 }
        public IBus CreateBusWithMockAmqpClient()
        {
            Logger = Logger ?? new ConsoleLogger();
            Model = Model ?? new MockModel();
            Connection = Connection ?? new MockConnection(Model);
            ConnectionFactory = ConnectionFactory ?? new MockConnectionFactory(Connection);
            Serializer = Serializer ?? new JsonSerializer();
            Conventions = Conventions ?? new Conventions();
            ConsumerErrorStrategy = ConsumerErrorStrategy ?? new DefaultConsumerErrorStrategy(ConnectionFactory, Serializer, Logger, Conventions);
            ConsumerFactory = ConsumerFactory ?? new QueueingConsumerFactory(Logger, ConsumerErrorStrategy);
            GetCorrelationId = GetCorrelationId ?? CorrelationIdGenerator.GetCorrelationId;

            var advancedBus = new RabbitAdvancedBus(
                new ConnectionConfiguration(),
                ConnectionFactory,
                TypeNameSerializer.Serialize,
                Serializer,
                ConsumerFactory,
                Logger,
                GetCorrelationId,
                Conventions);

            return new RabbitBus(
                TypeNameSerializer.Serialize,
                Logger,
                Conventions,
                advancedBus);
        }
 public ExpressionSerializer(ISerializer serializer, FactorySettings factorySettings = null)
 {
     if (serializer == null)
         throw new ArgumentNullException("serializer");
     _serializer = serializer;
     _factorySettings = factorySettings;
 }
        public void Serialize(ISerializer serializer, string name, Vector2 v)
        {
            ISerializer subSer = serializer.SubSerializer(name);

            subSer.SerializeString(tagX, v.X);
            subSer.SerializeString(tagY, v.Y);
        }
Exemple #11
0
 public void RegisterSerilizer(ISerializer serializer)
 {
     int id = nextID++;
     this.idToType.Add(id, serializer.SerializeType);
     this.typeToID.Add(serializer.SerializeType, id);
     this.serializerByType.Add(serializer.SerializeType, serializer);
 }
        public static IWhereFragment SimpleArrayContains(ISerializer serializer, QueryModel queryModel, ContainsResultOperator contains)
        {
            var from = queryModel.MainFromClause.FromExpression;
            var visitor = new FindMembers();
            visitor.Visit(from);

            var members = visitor.Members;

            var constant = contains.Item as ConstantExpression;

            if (constant != null)
            {
                var array = Array.CreateInstance(constant.Type, 1);
                array.SetValue(constant.Value, 0);

                var dict = new Dictionary<string, object>();
                dict.Add(members.Last().Name, array);

                members.Reverse().Skip(1).Each(m =>
                {
                    dict = new Dictionary<string, object>() { {m.Name, dict} };
                });

                return new ContainmentWhereFragment(serializer, dict);
            }

            throw new NotSupportedException();
        }
 public StatefullAggregateRepository(AggregateStore store, IDataFactory dataFactory, ISerializer serializer, AggregateRegistry aggregateRegistry, ITransitionStore transitionStore, AggregateDefinition definition)
     : base(store, dataFactory, definition)
 {
     _serializer = serializer;
     _aggregateRegistry = aggregateRegistry;
     _transitionStore = transitionStore;
 }
        public AttachmentResponseFactory(ISerializer serializer)
        {
            Ensure.That(serializer, "serializer").IsNotNull();

            SuccessfulResponseMaterializer = new AttachmentResponseMaterializer();
            FailedResponseMaterializer = new FailedResponseMaterializer(serializer);
        }
        public ContainmentWhereFragment(ISerializer serializer, BinaryExpression binary)
        {
            _serializer = serializer;

            var visitor = new FindMembers();
            visitor.Visit(binary.Left);

            var members = visitor.Members;

            if (members.Count > 1)
            {
                var dict = new Dictionary<string, object>();
                var member = members.Last();
                var value = MartenExpressionParser.Value(binary.Right);
                dict.Add(member.Name, value);

                members.Reverse().Skip(1).Each(m =>
                {
                    dict = new Dictionary<string, object> { { m.Name, dict}};
                });

                _dictionary = dict;
            }
            else
            {
                _dictionary = new Dictionary<string, object>();

                var member = members.Single();
                var value = MartenExpressionParser.Value(binary.Right);
                _dictionary.Add(member.Name, value);

            }
        }
 private void MakePostlyWebRequestAsync(ISerializer responseDeserializer, string relativeUrl, Action<PostLyExpandResponse> webRequestCallback)
 {
     MakeWebRequestAsync(
         responseDeserializer,
         new Uri(IsgdApiBaseUri, relativeUrl),
         webRequestCallback);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProtoBufRestClient"/> class.
 /// </summary>
 /// <param name="serializer">
 /// The serializer.
 /// </param>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <exception cref="Exception">
 /// Throws an exception if the serializer does not support ProtoBuffer
 /// </exception>
 public ProtoBufRestClient(ISerializer serializer, HttpClient client = null) : base(serializer, client)
 {
     if (serializer.Format != SerializationFormat.Json)
     {
         throw new Exception(string.Format("Invalid serializer type: {0}. Valid type is: {1}", serializer.Format, SerializationFormat.ProtoBuffer));
     }
 }
        public SqliteVsMonoDSSpeedTests()
        {
            // create path and filename to the database file.
            var documents = Environment.GetFolderPath (
                Environment.SpecialFolder.Personal);
            _db = Path.Combine (documents, "mydb.db3");

            if (File.Exists (_db))
                File.Delete (_db);

            SqliteConnection.CreateFile (_db);
            var conn = new SqliteConnection("URI=" + _db);
            using (var c = conn.CreateCommand()) {
                c.CommandText = "CREATE TABLE DataIndex (SearchKey INTEGER NOT NULL,Name TEXT NOT NULL,Email Text NOT NULL)";
                conn.Open ();
                c.ExecuteNonQuery ();
                conn.Close();
            }
            conn.Dispose();

            // create path and filename to the database file.
            var documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
            var libraryPath = Path.Combine (documentsPath, "..", "Library");
            _dataDirectory = Path.Combine (libraryPath, "MonoDS");
            _entity = "PersonEntity";
            _serializer = new Serializer();
        }
		public RedisQueue(
			ISerializer serializer, 
			IRedisClientsManager clientManager,
			IQueueKeyNameProvider keyNameProvider
			)
			: this(serializer, clientManager, keyNameProvider, 60)
		{ }
 public ZooKeeperServiceRouteManager(ZookeeperConfigInfo configInfo, ISerializer serializer, ILogger<ZooKeeperServiceRouteManager> logger)
 {
     _configInfo = configInfo;
     _serializer = serializer;
     _logger = logger;
     CreateZooKeeper();
 }
        public GameCreationManager(IPluginClient pluginClient, ISerializer serializer)
        {
            this.createGameService = new PluginService<CreateGameClientMessage, GameInviteReceivedServerMessage>(GamifyClientMessageType.CreateGame, GamifyServerMessageType.GameInviteReceived, pluginClient, serializer);
            this.acceptGameService = new PluginService<AcceptGameClientMessage, GameCreatedServerMessage>(GamifyClientMessageType.AcceptGame, GamifyServerMessageType.GameCreated, pluginClient, serializer);
            this.rejectGameService = new PluginService<RejectGameClientMessage, GameRejectedServerMessage>(GamifyClientMessageType.RejectGame, GamifyServerMessageType.GameRejected, pluginClient, serializer);

            this.createGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameInviteNotificationReceived != null)
                {
                    this.GameInviteNotificationReceived(this, args);
                }
            };

            this.acceptGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameCreatedNotificationReceived != null)
                {
                    this.GameCreatedNotificationReceived(this, args);
                }
            };

            this.rejectGameService.NotificationReceived += (sender, args) =>
            {
                if (this.GameRejectedNotificationReceived != null)
                {
                    this.GameRejectedNotificationReceived(this, args);
                }
            };
        }
Exemple #22
0
 public AdvancedOptions(IDocumentCleaner cleaner, StoreOptions options, ISerializer serializer, IDocumentSchema schema)
 {
     _serializer = serializer;
     _schema = schema;
     Options = options;
     Clean = cleaner;
 }
Exemple #23
0
 public void Setup()
 {
     _db = new JsonStore<EventDescriptor>();
       _db.DeleteAll();
       _serializer= new JsonSerializer();
       _sut = new Store( _db, _serializer);
 }
 public NewtonsoftJsonSerializer( ISerializer serializer )
 {
     ContentType = serializer.ContentType;
     DateFormat = serializer.DateFormat;
     Namespace = serializer.Namespace;
     RootElement = serializer.RootElement;
 }
        internal XDIOStreamListener(ISerializer serializer)
        {
            serializer.Requires().IsNotNull();

            this.serializer = serializer;
            watcherList = new Dictionary<string, FileSystemWatcher>(StringComparer.InvariantCultureIgnoreCase);
        }
 public InProcessQueueSender(ISerializer serializer, Queue queue, InProcessMessageStore messageStore, ILogger logger)
 {
     _serializer = serializer;
     _queue = queue;
     _messageStore = messageStore;
     _logger = logger;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceResultContext" /> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="frameworkProvider">The framework provider.</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="htmlEncoder">The HTML encoder.</param>
 public ResourceResultContext(ILogger logger, IFrameworkProvider frameworkProvider, ISerializer serializer, IHtmlEncoder htmlEncoder)
 {
     Logger = logger;
     FrameworkProvider = frameworkProvider;
     Serializer = serializer;
     HtmlEncoder = htmlEncoder;
 }
        void TestSerialization(ISerializer serializer)
        {
            DummSerializableClass dummyTestClass = new DummSerializableClass();
            dummyTestClass.BoolProperty = true;
            dummyTestClass.IntProperty = 5;
            dummyTestClass.LongProperty = (long)int.MaxValue * 2;
            dummyTestClass.DecimalProperty = (decimal)5.1;
            dummyTestClass.DoubleProperty = 5.3;
            dummyTestClass.StringProperty = "test";
            dummyTestClass.SubClassProperty = new DummySubClass() { Id = 15, Name = "test name" };
            dummyTestClass.ListProperty = new List<DummySubClass>();
            dummyTestClass.ListProperty.Add(new DummySubClass() { Id = 200, Name = "child 1 test name" });
            dummyTestClass.ListProperty.Add(new DummySubClass() { Id = 201, Name = "child 2 test name" });

            DummSerializableClass deserialized = (DummSerializableClass)serializer.Deserialize(serializer.Serialize(dummyTestClass));
            Assert.AreNotEqual(dummyTestClass, deserialized);
            Assert.AreEqual(dummyTestClass.BoolProperty, deserialized.BoolProperty);
            Assert.AreEqual(dummyTestClass.IntProperty, deserialized.IntProperty);
            Assert.AreEqual(dummyTestClass.LongProperty, deserialized.LongProperty);
            Assert.AreEqual(dummyTestClass.DecimalProperty, deserialized.DecimalProperty);
            Assert.AreEqual(dummyTestClass.DoubleProperty, deserialized.DoubleProperty);
            Assert.AreEqual(dummyTestClass.StringProperty, deserialized.StringProperty);
            Assert.AreEqual(dummyTestClass.SubClassProperty.Name, deserialized.SubClassProperty.Name);
            Assert.AreEqual(dummyTestClass.SubClassProperty.Id, deserialized.SubClassProperty.Id);
            Assert.AreEqual(dummyTestClass.ListProperty.Count(), deserialized.ListProperty.Count());
            Assert.AreEqual(dummyTestClass.ListProperty[0].Id, deserialized.ListProperty[0].Id);
            Assert.AreEqual(dummyTestClass.ListProperty[0].Name, deserialized.ListProperty[0].Name);
            Assert.AreEqual(dummyTestClass.ListProperty[1].Id, deserialized.ListProperty[1].Id);
            Assert.AreEqual(dummyTestClass.ListProperty[1].Name, deserialized.ListProperty[1].Name);
        }
Exemple #29
0
        public CommandCoordinator(ISerializer serializer, IHubProxyManager hubProxyFactory)
        {
            _serializer = serializer;

            _proxy = hubProxyFactory.Get<Proxies.ICommandCoordinator>();
            _proxy.EventsProcessed += EventsProcessed;
        }
Exemple #30
0
 private void MakeIsgdWebRequestAsync(ISerializer responseDeserializer, string relativeUrl, Action<IsgdExpandResponse> webRequestCallback)
 {
     this.MakeWebRequestAsync(
         responseDeserializer,
         new Uri(IsgdApiBaseUri, relativeUrl + string.Format("&format=json")),
         webRequestCallback);
 }
 /// <summary>
 /// Create a token provider to authenticate against an ArcGIS Server federated with Portal for ArcGIS
 /// </summary>
 /// <param name="rootUrl"></param>
 /// <param name="username">Portal for ArcGIS user name</param>
 /// <param name="password">Portal for ArcGIS user password</param>
 /// <param name="serializer">Used to (de)serialize requests and responses</param>
 /// <param name="referer">Referer url to use for the token generation. For federated servers this will be the rootUrl + '/rest'</param>
 /// <param name="cryptoProvider">Used to encrypt the token reuqest. If not set it will use the default from CryptoProviderFactory</param>
 public ServerFederatedWithPortalTokenProvider(string rootUrl, string username, string password, ISerializer serializer = null, string referer = null, ICryptoProvider cryptoProvider = null, Func <HttpClient> httpClientFunc = null)
     : base(rootUrl, username, password, serializer, referer, cryptoProvider, httpClientFunc)
 {
     TokenRequest.IsFederated = true;
     if (string.IsNullOrWhiteSpace(referer))
     {
         TokenRequest.Referer = rootUrl.TrimEnd('/') + "/rest";
     }
 }
Exemple #32
0
 public object Serdes(object existing, AssetInfo info, AssetMapping mapping, ISerializer s, IJsonUtil jsonUtil)
 => Serdes((IReadOnlyTexture <byte>)existing, info, mapping, s, jsonUtil);
 public MessageHandler(IShamanLogger logger, ISerializer serializer)
 {
     _logger     = logger;
     _serializer = serializer;
 }
		public StateAdapter(IState<TSerialized> underlyingState, ISerializer<T, TSerialized> serializer)
		{
			_underlyingState = underlyingState;
			_serializer = serializer;
		}
Exemple #35
0
 /// <summary>
 /// Gets the serialization context information.
 /// </summary>
 /// <param name="serializer">The serializer.</param>
 /// <param name="model">The model.</param>
 /// <param name="data">The data.</param>
 /// <param name="configuration">The configuration.</param>
 /// <returns>
 /// ISerializationContext.
 /// </returns>
 public ISerializationContextInfo GetSerializationContextInfo(ISerializer serializer, object model, object data, ISerializationConfiguration configuration)
 {
     return(new XmlSerializationContextInfo((XElement)data, model));
 }
Exemple #36
0
 public MessageConsumer(SubscriptionClient client, ISerializer serializer)
 {
     _client     = client;
     _serializer = serializer;
 }
 /// <summary>
 /// Registers a new serializer for the specified type.
 /// </summary>
 /// <typeparam name="T">The field type</typeparam>
 /// <param name="serializer">The serializer</param>
 public void Register <T>(ISerializer serializer)
 {
     items[typeof(T)] = serializer;
 }
Exemple #38
0
 private static Action <Stream> GetXmlContents(TModel model, ISerializer serializer)
 {
     return(stream => serializer.Serialize(DefaultContentType, model, stream));
 }
Exemple #39
0
 public Serializer(ISpecification <object> specification, ISerializer serializer)
 {
     _specification = specification;
     _serializer    = serializer;
 }
 public abstract void AddSerializer(ISerializer serializer);
 public NuGetClient(IRestfulApiClient restfulApiClient, ISerializer serializer)
 {
     _restfulApiClient = restfulApiClient;
     _serializer       = serializer;
 }
Exemple #42
0
        public KafkaDispatcher(ILogger <KafkaDispatcher <T> > logger, IOptionsMonitor <KafkaOptions <T> > options, ISerializer serializer)
            : base(logger)
        {
            _serializer  = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _contentType = Encoding.UTF8.GetBytes(_serializer.ContentType);
            _options     = options ?? throw new ArgumentNullException(nameof(options));

            _producer = new ProducerBuilder <byte[], byte[]>(options.CurrentValue.KafkaConfiguration).SetErrorHandler(Kafka_OnError)
                        .SetLogHandler(Kafka_OnLog)
                        .SetStatisticsHandler(Kafka_OnStatistics)
                        .Build();
        }
 //-----------------------------------------------------------------------------------------
 public override void AddSerializer(ISerializer serializer)
 {
     _serializer = serializer;
 }
Exemple #44
0
 public YamlConfiguration()
 {
     deserializer = new DeserializerBuilder().Build();
     serializer   = new SerializerBuilder().Build();
 }
 /// <summary>
 /// Constructs the step, using the specified serializer to do its thing
 /// </summary>
 public DeserializeIncomingMessageStep(ISerializer serializer)
 {
     _serializer = serializer;
 }
Exemple #46
0
 public ISerializerToMemberConfiguration <TTInterface> WithSerializer(ISerializer serializer)
 {
     _serializer = serializer;
     return(this);
 }
Exemple #47
0
 /// <summary>
 /// Allows an object to serialize its own data using the <paramref name="writer"/>
 /// </summary>
 /// <param name="writer">The <see cref="ISerializer"/> that is used to serialize the data.</param>
 public void Serialize(ISerializer writer)
 {
     writer.Write(CodePage);
     writer.Write(Threshold);
     writer.Write(Encoding.Unicode.GetBytes(CompressorType.AssemblyQualifiedName));
 }
Exemple #48
0
 public HttpClient(ISerializer requestSerializer = null, ISerializer responseSerializer = null)
     : base(requestSerializer ?? new JsonSerializer(), responseSerializer ?? new JsonSerializer())
 {
 }
Exemple #49
0
 public RabbitMqPublisher(ISerializer serializer, IConnectionFactory connectionFactory)
 {
     this.serializer        = serializer;
     this.connectionFactory = connectionFactory;
 }
Exemple #50
0
 internal RedisUtility(ProviderConfiguration configuration)
 {
     _configuration = configuration;
     _serializer    = GetSerializer();
 }
Exemple #51
0
 public HttpClient SetSerializers(ISerializer requestSerializer = null, ISerializer responseSerializer = null)
 {
     _requestSerializer  = requestSerializer;
     _responseSerializer = responseSerializer;
     return(this);
 }
 public TimeoutManager(ITransport transport, ISerializer serializer)
 {
     m_transport  = transport;
     m_serializer = serializer;
 }
Exemple #53
0
 public HttpClient(ISerializer serializer = null)
     : base(serializer ?? new JsonSerializer(), serializer ?? new JsonSerializer())
 {
 }
Exemple #54
0
 public DeadLetterStrategy(IConnectionFactory connectionFactory, ISerializer serializer, IEasyNetQLogger logger, IConventions conventions, ITypeNameSerializer typeNameSerializer)
     : base(connectionFactory, serializer, logger, conventions, typeNameSerializer)
 {
 }
Exemple #55
0
 public AWSQueue(string queueName = null)
 {
     _queueUrl  = GetOrCreateQueue(queueName);
     Serializer = new JsonSerializer();
 }