/// <summary> /// Initializes a new instance. /// </summary> /// <param name="ioService"></param> /// <param name="uri"></param> /// <param name="accept"></param> public static XmlReader Create(IIOService ioService, Uri uri, MediaRangeList accept) { Contract.Requires<ArgumentNullException>(ioService != null); Contract.Requires<ArgumentNullException>(uri != null); // default acceptable media types accept = !accept.IsEmpty ? accept : XML_MEDIA_RANGES; // format request var request = new IORequest(uri, IOMethod.Get) { Accept = accept, }; // get response var response = ioService.Send(request); if (response.Status != IOStatus.Success) throw new XmlException(); // acceptable response? if (!response.ContentType.Matches(accept)) throw new XmlException(); return new IOXmlReader(uri, response.Content); }
public ArtistAdministrationVM(IAdministrationServices services, IIOService ioService) { this.administrationService = services; this.ioService = ioService; Artists = new ObservableCollection<ArtistVM>(); AddNewArtistCommand = new RelayCommand(s => { CurrentArtist = new ArtistVM(new Artist(),administrationService, ioService); Artists.Add(CurrentArtist); RaisePropertyChangedEvent(nameof(CurrentArtist)); RaisePropertyChangedEvent(nameof(Artists)); }); AppMessages.ArtistChanged.Register(this, (type) => { if(type == AppMessages.ChangeType.Remove) { LoadArtists(); } RaisePropertyChangedEvent(nameof(CurrentArtist)); RaisePropertyChangedEvent(nameof(Artists)); }); AppMessages.CatagoryChanged.Register(this, (type) => { this.LoadItems(); RaisePropertyChangedEvent(nameof(Artists)); RaisePropertyChangedEvent(nameof(Catagory)); }); LoadArtists(); }
public void CompressedMessage(IIOService service, CompressedMessage message, MessageReceivedEventArgs e) { var decompressed = message.Data.DecompressZLib(); ProudCoreOpCode opCode; byte[] data; using (var r = decompressed.ToBinaryReader()) { opCode = r.ReadEnum <ProudCoreOpCode>(); data = r.ReadToEnd(); } switch (opCode) { case ProudCoreOpCode.Rmi: var rmi = new RmiMessage(data) { IsRelayed = message.IsRelayed, SenderHostId = message.SenderHostId, TargetHostId = message.TargetHostId }; e.Message = rmi; _filter.OnMessageReceived(e); break; default: throw new ProudException("Invalid opCode inside CompressedMessage: " + opCode); } }
public Server(IIOService ioService, INodeAdapter nodeAdapter, ClientConfiguration clientConfiguration, IBucketConfig bucketConfig, ITypeTranscoder transcoder, ConcurrentDictionary <string, QueryPlan> queryCache) : this(ioService, new ViewClient(new CouchbaseHttpClient(clientConfiguration, bucketConfig) { Timeout = new TimeSpan(0, 0, 0, 0, clientConfiguration.ViewRequestTimeout) }, new JsonDataMapper(clientConfiguration), clientConfiguration), new StreamingViewClient(new CouchbaseHttpClient(clientConfiguration, bucketConfig) { Timeout = new TimeSpan(0, 0, 0, 0, clientConfiguration.ViewRequestTimeout) }, new JsonDataMapper(clientConfiguration), clientConfiguration), new QueryClient(new CouchbaseHttpClient(clientConfiguration, bucketConfig) { Timeout = new TimeSpan(0, 0, 0, 0, (int)clientConfiguration.QueryRequestTimeout) }, new JsonDataMapper(clientConfiguration), clientConfiguration, queryCache), new StreamingQueryClient(new CouchbaseHttpClient(clientConfiguration, bucketConfig) { Timeout = new TimeSpan(0, 0, 0, 0, (int)clientConfiguration.QueryRequestTimeout) }, new JsonDataMapper(clientConfiguration), clientConfiguration, queryCache), new SearchClient(new CouchbaseHttpClient(clientConfiguration, bucketConfig) { Timeout = new TimeSpan(0, 0, 0, 0, (int)clientConfiguration.SearchRequestTimeout) }, new SearchDataMapper(), clientConfiguration), new AnalyticsClient(new CouchbaseHttpClient(clientConfiguration, bucketConfig) { Timeout = new TimeSpan(0, 0, 0, 0, (int)clientConfiguration.QueryRequestTimeout) }, new JsonDataMapper(clientConfiguration), clientConfiguration), nodeAdapter, clientConfiguration, transcoder, bucketConfig) { }
public BankStatementsController(IBankStatementRepository bankStatementRepository, IMapper mapper, IIOService ioservice, IBankStatementService bankStatementService) { _bankStatementRepository = bankStatementRepository; _mapper = mapper; _ioservice = ioservice; _bankStatementService = bankStatementService; }
/// <summary> /// Creates a <see cref="CramMd5Mechanism"/> object using a given username (which is a Couchbase Bucket) and password. /// </summary> /// <param name="ioService">The <see cref="IOService"/>to use for I/O.</param> /// <param name="username">The name of the Bucket you are connecting to.</param> /// <param name="password">The password for the Bucket.</param> /// <param name="transcoder"></param> public CramMd5Mechanism(IIOService ioService, string username, string password, ITypeTranscoder transcoder) { _ioService = ioService; Username = username; Password = password; _transcoder = transcoder; }
private void ChooseEmail() { IIOService ioService = EasyIoc.IocContainer.Default.Resolve <IIOService>(); string mailsPath = ConfigurationManager.AppSettings["MailTemplatesPath"]; string filePath = ioService.OpenFileDialog(mailsPath, "html", "html files (*.html)|*.html"); try { if (!string.IsNullOrWhiteSpace(filePath)) { string html = File.ReadAllText(filePath); if (!string.IsNullOrWhiteSpace(html)) { html = html.Replace("\t", string.Empty).Replace(Environment.NewLine, string.Empty); // Remove cid:[tag] with tag related filename Regex pattern = new Regex(@"img src=""(?<cid>cid\:\w+)"""); EmailContent = pattern.ReplaceGroup(html, "cid", ReplaceCid); } } } catch (Exception ex) { Logger.Exception(ex); } }
/// <summary> /// For testing purposes only. /// </summary> internal SymbolSearchService( Workspace workspace, IPackageInstallerService installerService, IRemoteControlService remoteControlService, ILogService logService, IDelayService delayService, IIOService ioService, IPatchService patchService, IDatabaseFactoryService databaseFactoryService, string localSettingsDirectory, Func<Exception, bool> reportAndSwallowException, CancellationTokenSource cancellationTokenSource) { if (remoteControlService == null) { // If we can't access the file update service, then there's nothing we can do. return; } _workspace = workspace; _installerService = installerService; _delayService = delayService; _ioService = ioService; _logService = logService; _remoteControlService = remoteControlService; _patchService = patchService; _databaseFactoryService = databaseFactoryService; _localSettingsDirectory = localSettingsDirectory; _reportAndSwallowException = reportAndSwallowException; _cancellationTokenSource = cancellationTokenSource; _cancellationToken = _cancellationTokenSource.Token; }
public void OneTimeSetUp() { var ipEndpoint = UriExtensions.GetEndPoint(_address); var connectionPoolConfig = new PoolConfiguration(); _connectionPool = new ConnectionPool<Connection>(connectionPoolConfig, ipEndpoint); _ioService = new PooledIOService(_connectionPool); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="ioService"></param> /// <param name="uri"></param> /// <returns></returns> public static TextReader Create(IIOService ioService, Uri uri) { Contract.Requires <ArgumentNullException>(ioService != null); Contract.Requires <ArgumentNullException>(uri != null); return(Create(ioService, uri, TXT_MEDIA_RANGES, null)); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="ioService"></param> /// <param name="uri"></param> /// <param name="accept"></param> /// <returns></returns> public static TextReader Create(IIOService ioService, Uri uri, MediaRangeList accept) { Contract.Requires <ArgumentNullException>(ioService != null); Contract.Requires <ArgumentNullException>(uri != null); return(Create(ioService, uri, accept, null)); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="ioService"></param> /// <param name="uri"></param> /// <param name="accept"></param> public static XmlReader Create(IIOService ioService, Uri uri, MediaRangeList accept) { Contract.Requires <ArgumentNullException>(ioService != null); Contract.Requires <ArgumentNullException>(uri != null); // default acceptable media types accept = !accept.IsEmpty ? accept : XML_MEDIA_RANGES; // format request var request = new IORequest(uri, IOMethod.Get) { Accept = accept, }; // get response var response = ioService.Send(request); if (response.Status != IOStatus.Success) { throw new XmlException(); } // acceptable response? if (!response.ContentType.Matches(accept)) { throw new XmlException(); } return(new IOXmlReader(uri, response.Content)); }
public AdministrationVM(IAdministrationServices service, IIOService ioService) { this.administrationService = service; this.ioService = ioService; this.currentArtistAdministration = new ArtistAdministrationVM(this.administrationService, ioService); this.currentCatagoryAdministration = new CatagoryAdministrationVM(this.administrationService); this.currentVenueAdministration = new VenueAdministrationVM(this.administrationService); this.currentPerformanceAdministration = new PerformanceAdministrationVM(this.administrationService); Login = new RelayCommand((c) => { var box = c as PasswordBox; var password = box.Password; user = service.CheckUser(UserName, password); if (user != null) { LoggedIn = true; LoginFailedMessage = ""; RaisePropertyChangedEvent(nameof(LoggedIn)); } else { LoginFailedMessage = "UserId or Password is invalid"; RaisePropertyChangedEvent(nameof(LoginFailedMessage)); } }); }
public DocumentTest() { ioService = new IOService(); var service = new InterViewerService(ioService); documents = service.GetDocuments(); }
public AdministrationVM(IAdministrationServices service, IIOService ioService) { this.administrationService = service; this.ioService = ioService; this.currentArtistAdministration = new ArtistAdministrationVM(this.administrationService, ioService); this.currentCatagoryAdministration = new CatagoryAdministrationVM(this.administrationService); this.currentVenueAdministration = new VenueAdministrationVM(this.administrationService); this.currentPerformanceAdministration = new PerformanceAdministrationVM(this.administrationService); Login = new RelayCommand((c) => { var box = c as PasswordBox; var password = box.Password; user = service.CheckUser(UserName, password); if(user != null) { LoggedIn = true; LoginFailedMessage = ""; RaisePropertyChangedEvent(nameof(LoggedIn)); } else { LoginFailedMessage = "UserId or Password is invalid"; RaisePropertyChangedEvent(nameof(LoginFailedMessage)); } }); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="ioService"></param> /// <param name="uri"></param> /// <param name="accept"></param> public static TextReader Create(IIOService ioService, Uri uri, MediaRangeList accept, Encoding encoding) { Contract.Requires <ArgumentNullException>(ioService != null); Contract.Requires <ArgumentNullException>(uri != null); var request = new IORequest(uri, IOMethod.Get) { Accept = accept, }; var response = ioService.Send(request); if (response.Status != IOStatus.Success) { throw new IOException(); } if (!response.ContentType.Matches(accept)) { throw new IOException(); } if (encoding != null) { return(new IOTextReader(uri, response.Content, encoding)); } else { return(new IOTextReader(uri, response.Content)); } }
public ArtistAdministrationVM(IAdministrationServices services, IIOService ioService) { this.administrationService = services; this.ioService = ioService; Artists = new ObservableCollection <ArtistVM>(); AddNewArtistCommand = new RelayCommand(s => { CurrentArtist = new ArtistVM(new Artist(), administrationService, ioService); Artists.Add(CurrentArtist); RaisePropertyChangedEvent(nameof(CurrentArtist)); RaisePropertyChangedEvent(nameof(Artists)); }); AppMessages.ArtistChanged.Register(this, (type) => { if (type == AppMessages.ChangeType.Remove) { LoadArtists(); } RaisePropertyChangedEvent(nameof(CurrentArtist)); RaisePropertyChangedEvent(nameof(Artists)); }); AppMessages.CatagoryChanged.Register(this, (type) => { this.LoadItems(); RaisePropertyChangedEvent(nameof(Artists)); RaisePropertyChangedEvent(nameof(Catagory)); }); LoadArtists(); }
public PlainTextMechanism(IIOService service, string username, string password, ITypeTranscoder transcoder) { _service = service; Username = username; Password = password; _transcoder = transcoder; }
/// <summary> /// Creates a <see cref="CramMd5Mechanism"/> object using a given username (which is a Couchbase Bucket) and password. /// </summary> /// <param name="ioService">The <see cref="IOService"/>to use for I/O.</param> /// <param name="username">The name of the Bucket you are connecting to.</param> /// <param name="password">The password for the Bucket.</param> /// <param name="transcoder"></param> public CramMd5Mechanism(IIOService ioService, string username, string password, ITypeTranscoder transcoder) { _ioService = ioService; Username = username; Password = password; _transcoder = transcoder; }
public PlainTextMechanism(IIOService service, string username, string password, ITypeTranscoder transcoder) { _service = service; Username = username; Password = password; _transcoder = transcoder; }
public Server(IIOService ioService, INodeAdapter nodeAdapter, ITypeTranscoder transcoder, ConcurrentDictionary <string, QueryPlan> queryCache, ConfigContextBase context) : this(ioService, new ViewClient(new CouchbaseHttpClient(context) { Timeout = new TimeSpan(0, 0, 0, 0, context.ClientConfig.ViewRequestTimeout) }, new JsonDataMapper(context), context), new StreamingViewClient(new CouchbaseHttpClient(context) { Timeout = new TimeSpan(0, 0, 0, 0, context.ClientConfig.ViewRequestTimeout) }, new JsonDataMapper(context), context), new QueryClient(new CouchbaseHttpClient(context) { Timeout = new TimeSpan(0, 0, 0, 0, (int)context.ClientConfig.QueryRequestTimeout) }, new JsonDataMapper(context), queryCache, context), new StreamingQueryClient(new CouchbaseHttpClient(context) { Timeout = new TimeSpan(0, 0, 0, 0, (int)context.ClientConfig.QueryRequestTimeout) }, new JsonDataMapper(context), queryCache, context), new SearchClient(new CouchbaseHttpClient(context) { Timeout = new TimeSpan(0, 0, 0, 0, (int)context.ClientConfig.SearchRequestTimeout) }, new SearchDataMapper(), context), new AnalyticsClient(new CouchbaseHttpClient(context) { Timeout = new TimeSpan(0, 0, 0, 0, (int)context.ClientConfig.QueryRequestTimeout) }, new JsonDataMapper(context), context), nodeAdapter, transcoder, context) { }
public InMemoryDataStoreTest() { FHClient.Init(); _ioService = ServiceFinder.Resolve<IIOService>(); var dataDir = _ioService.GetDataPersistDir(); var dataPersistDir = Path.Combine(dataDir, "syncTestDir"); _dataPersistFile = Path.Combine(dataPersistDir, ".test_data_file"); }
/// <summary> /// Get default storage path. /// </summary> /// <param name="dataId"></param> /// <returns></returns> public static string GetDefaultDataDir(string dataId) { IIOService ioService = ServiceFinder.Resolve <IIOService> (); string dirName = "com_feedhenry_sync"; string dataDirPath = Path.Combine(ioService.GetDataPersistDir(), dataId, dirName); return(dataDirPath); }
private void DoRemoveService(IIOService service) { if (service.FrontController != this) { service.FrontController = null; } this.services.Remove(service); }
public void TestFixtureSetUp() { var ipEndpoint = UriExtensions.GetEndPoint(_address); var connectionPoolConfig = new PoolConfiguration(); _connectionPool = new ConnectionPool<Connection>(connectionPoolConfig, ipEndpoint); _connectionPool.Initialize(); _ioService = new PooledIOService(_connectionPool, null); }
public PlainTextMechanism(IIOService service, string username, string password, ITypeTranscoder transcoder, ILoggerFactory loggerFactory) { _service = service; Username = username; Password = password; _transcoder = transcoder; Log = loggerFactory.CreateLogger<CramMd5Mechanism>(); }
public Server(IIOService ioService, INodeAdapter nodeAdapter, ClientConfiguration clientConfiguration, IBucketConfig bucketConfig, ITypeTranscoder transcoder, ConcurrentDictionary <string, QueryPlan> queryCache) : this(ioService, new ViewClient(new HttpClient(), new JsonDataMapper(clientConfiguration), bucketConfig, clientConfiguration), new QueryClient(new HttpClient(), new JsonDataMapper(clientConfiguration), bucketConfig, clientConfiguration, queryCache), nodeAdapter, clientConfiguration, transcoder, bucketConfig) { }
public Server(IIOService ioService, INodeAdapter nodeAdapter, ClientConfiguration clientConfiguration, IBucketConfig bucketConfig, ITypeTranscoder transcoder) : this(ioService, new ViewClient(new HttpClient(), new JsonDataMapper(clientConfiguration), bucketConfig, clientConfiguration), new QueryClient(new HttpClient(), new JsonDataMapper(clientConfiguration), bucketConfig, clientConfiguration), nodeAdapter, clientConfiguration, transcoder, bucketConfig) { }
public SourceService(INhContext context, IIOService ioService) { _context = context; _ioService = ioService; _localPath = _ioService.CombinePath( AppDomain.CurrentDomain.BaseDirectory, context.AppSettings["SourceTargetFolder"]); }
/// <summary> /// Creates a <see cref="CramMd5Mechanism"/> object using a given username (which is a Couchbase Bucket) and password. /// </summary> /// <param name="ioService">The <see cref="IOService"/>to use for I/O.</param> /// <param name="username">The name of the Bucket you are connecting to.</param> /// <param name="password">The password for the Bucket.</param> /// <param name="transcoder"></param> public CramMd5Mechanism(IIOService ioService, string username, string password, ITypeTranscoder transcoder, ILoggerFactory loggerFactory) { Log = loggerFactory.CreateLogger<CramMd5Mechanism>(); _ioService = ioService; Username = username; Password = password; _transcoder = transcoder; }
public void TestFixtureSetUp() { var ipEndpoint = UriExtensions.GetEndPoint(_address); var connectionPoolConfig = new PoolConfiguration(); _connectionPool = new ConnectionPool <Connection>(connectionPoolConfig, ipEndpoint); _ioService = new PooledIOService(_connectionPool); }
public virtual void TestFixtureSetUp() { EndPoint = UriExtensions.GetEndPoint(Address); var connectionPoolConfig = new PoolConfiguration(); _connectionPool = new ConnectionPool<Connection>(connectionPoolConfig, EndPoint); _ioService = new PooledIOService(_connectionPool); Transcoder = new DefaultTranscoder(); }
public FakeServer(IConnectionPool connectionPool, IViewClient viewClient, IQueryClient queryClient, IPEndPoint endPoint, IIOService service) { ConnectionPool = connectionPool; ViewClient = viewClient; QueryClient = queryClient; EndPoint = endPoint; Service = service; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IIOService ioService)//, IInventurDataService dbService) { //this._dataService = dataService; this._ioService = ioService; this.UpdateMode = false; //_db = dbService; loadData(); #region Commands this.Add = new RelayCommand(() => { this.AddItem(); }); this.Clear = new RelayCommand(() => { this.CurrentItem = new InventurItemModel(); UpdateMode = false; }); this.DeleteItem = new RelayCommand <InventurItemModel>((i) => { this.Invented.Remove(i); }); this.ExportFile = new RelayCommand(() => { //if (!_dataService.FileExists()) //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Es wurden noch keine Artikel erfasst!", Title = "Keine Artikel" }); // return; //} //var fname = this._ioService.OpenSaveFileDialog(); //if (string.IsNullOrEmpty(fname)) return; //if (System.IO.File.Exists(fname)) //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Zieldatei exisitert bereits! Bitte anderen Dateiname wählen oder Zieldatei löschen!", Title = "Datei bereits vorhanden" }); // return; //} //this._dataService.CopyToTarget(fname); //if (System.IO.File.Exists(fname)) //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Datei wurde am Zielort angelegt!", Title = "Export beendet" }); //} //else //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Beim anlegen der Zieldatei ist ein Fehler aufgetreten! Bitte kontaktieren Sie Ihren Administrator ", Title = "Export fehler" }); // return; //} //_dataService.Init(); this.CurrentItem = new InventurItemModel(); UpdateMode = false; loadData(); Messenger.Default.Send <SetFocusArticleIdMessage>(new SetFocusArticleIdMessage()); }); #endregion Commands }
//, IInventurDataService dbService) /// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IIOService ioService) { //this._dataService = dataService; this._ioService = ioService; this.UpdateMode = false; //_db = dbService; loadData(); #region Commands this.Add = new RelayCommand(() => { this.AddItem(); }); this.Clear = new RelayCommand(() => { this.CurrentItem = new InventurItemModel(); UpdateMode = false; }); this.DeleteItem = new RelayCommand<InventurItemModel>((i) => { this.Invented.Remove(i); }); this.ExportFile = new RelayCommand(() => { //if (!_dataService.FileExists()) //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Es wurden noch keine Artikel erfasst!", Title = "Keine Artikel" }); // return; //} //var fname = this._ioService.OpenSaveFileDialog(); //if (string.IsNullOrEmpty(fname)) return; //if (System.IO.File.Exists(fname)) //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Zieldatei exisitert bereits! Bitte anderen Dateiname wählen oder Zieldatei löschen!", Title = "Datei bereits vorhanden" }); // return; //} //this._dataService.CopyToTarget(fname); //if (System.IO.File.Exists(fname)) //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Datei wurde am Zielort angelegt!", Title = "Export beendet" }); //} //else //{ // Messenger.Default.Send<MboxMessage>(new MboxMessage { Message = "Beim anlegen der Zieldatei ist ein Fehler aufgetreten! Bitte kontaktieren Sie Ihren Administrator ", Title = "Export fehler" }); // return; //} //_dataService.Init(); this.CurrentItem = new InventurItemModel(); UpdateMode = false; loadData(); Messenger.Default.Send<SetFocusArticleIdMessage>(new SetFocusArticleIdMessage()); }); #endregion Commands }
public void OneTimeSetUp() { _endPoint = UriExtensions.GetEndPoint(_address); var connectionPoolConfig = new PoolConfiguration(1, 1); _connectionPool = new ConnectionPool <Connection>(connectionPoolConfig, _endPoint); _ioService = new PooledIOService(_connectionPool); }
private void DoAddService(IIOService service) { if (service.FrontController == null || service.FrontController != this) { service.FrontController = this; } lock (services) this.services.Add(service); }
public virtual void TestFixtureSetUp() { EndPoint = UriExtensions.GetEndPoint(Address); var connectionPoolConfig = new PoolConfiguration(); _connectionPool = new ConnectionPool <Connection>(connectionPoolConfig, EndPoint); _ioService = new PooledIOService(_connectionPool); Transcoder = new DefaultTranscoder(); }
public void ScramShaMechanism_WhenServiceIsNullInCtor_ThrowArgumentNullException() { IIOService service = null; var transcoder = new DefaultTranscoder(new DefaultConverter()); // ReSharper disable once ExpressionIsAlwaysNull // ReSharper disable once ObjectCreationAsStatement Assert.Throws <ArgumentNullException>(() => new ScramShaMechanism(service, transcoder, MechanismType.ScramSha256)); }
public RhymeGenerator( IIOService ioService, IValidator validator, ISongWriter songWriter) { _ioService = ioService; _validator = validator; _songWriter = songWriter; }
public Server(IIOService ioService, IViewClient viewClient, IViewClient streamingViewClient, IQueryClient queryClient, IQueryClient streamingQueryClient, ISearchClient searchClient, IAnalyticsClient analyticsClient, INodeAdapter nodeAdapter, ClientConfiguration clientConfiguration, ITypeTranscoder transcoder, IBucketConfig bucketConfig) { if (ioService != null) { _ioService = ioService; _ioService.ConnectionPool.Owner = this; } _nodeAdapter = nodeAdapter; _clientConfiguration = clientConfiguration; _bucketConfiguration = clientConfiguration.BucketConfigs[bucketConfig.Name]; _timingEnabled = _clientConfiguration.EnableOperationTiming; _typeTranscoder = transcoder; _bucketConfig = bucketConfig; //services that this node is responsible for IsMgmtNode = _nodeAdapter.MgmtApi > 0; IsDataNode = _nodeAdapter.KeyValue > 0; IsQueryNode = _nodeAdapter.N1QL > 0; IsIndexNode = _nodeAdapter.IndexAdmin > 0; IsViewNode = _nodeAdapter.Views > 0; IsSearchNode = _nodeAdapter.IsSearchNode; IsAnalyticsNode = _nodeAdapter.IsAnalyticsNode; //View and query clients ViewClient = viewClient; _streamingViewClient = streamingViewClient; QueryClient = queryClient; SearchClient = searchClient; _streamingQueryClient = streamingQueryClient; AnalyticsClient = analyticsClient; CachedViewBaseUri = UrlUtil.GetViewBaseUri(_nodeAdapter, _bucketConfiguration); CachedQueryBaseUri = UrlUtil.GetN1QLBaseUri(_nodeAdapter, _bucketConfiguration); if (IsDataNode || IsQueryNode) { _lastIOErrorCheckedTime = DateTime.Now; //On initialization, data nodes are authenticated, so they can start in a down state. //If the node is down immediately start the timer, otherwise disable it. if (IsDataNode) { _isDown = _ioService.ConnectionPool.InitializationFailed; } Log.Info("Initialization {0} for node {1}", _isDown ? "failed" : "succeeded", EndPoint); //timer and node status _heartBeatTimer = new Timer(_heartBeatTimer_Elapsed, null, Timeout.Infinite, Timeout.Infinite); if (_isDown) { StartHeartbeatTimer(); } } }
public void OneTimeSetUp() { var ipEndpoint = UriExtensions.GetEndPoint(Address); var connectionPoolConfig = new PoolConfiguration(); _connectionPool = new ConnectionPool <Connection>(connectionPoolConfig, ipEndpoint); _connectionPool.Initialize(); _ioService = new PooledIOService(_connectionPool, null); }
public InMemoryDataStoreTest() { FHClient.Init(); _ioService = ServiceFinder.Resolve <IIOService>(); var dataDir = _ioService.GetDataPersistDir(); var dataPersistDir = Path.Combine(dataDir, "syncTestDir"); _dataPersistFile = Path.Combine(dataPersistDir, ".test_data_file"); }
public SequenceDiagramDocumentModel(IConfiguration configuration, IIOService openDirectoryService, UMLSequenceDiagram diagram, LockedList <UMLClassDiagram> dataTypes, string fileName, string title, string content, AutoResetEvent messageCheckerTrigger) : base(configuration, openDirectoryService, fileName, title, content, messageCheckerTrigger) { Diagram = diagram; DataTypes = dataTypes; colorCodingProvider = new UMLColorCoding(); }
public BrandedEmailSender(IIOService ioService, IRazorTemplateResolver templateResolver, IMailer mailer) { this.ioService = ioService; this.templateResolver = templateResolver; this.mailer = mailer; EmailPath = "~/Emails"; BrandedTemplateFolder = "BrandTemplates"; BrandedMessageFolder = "Messages"; }
public HttpHandler( IIOService ioService, [ImportMany] IEnumerable<IModelSerializer> serializers, [ImportMany] IEnumerable<IModelDeserializer> deserializers) : base(ioService, serializers, deserializers) { Contract.Requires<ArgumentNullException>(ioService != null); Contract.Requires<ArgumentNullException>(serializers != null); Contract.Requires<ArgumentNullException>(deserializers != null); }
public void TestFixtureSetUp() { var ipEndpoint = UriExtensions.GetEndPoint(_address.Replace("11210", "11207")); var connectionPoolConfig = new PoolConfiguration { UseSsl = true }; _connectionPool = new ConnectionPool<SslConnection>(connectionPoolConfig, ipEndpoint); _connectionPool.Initialize(); _ioService = new PooledIOService(_connectionPool, null); }
public void OneTimeSetUp() { var ipEndpoint = UriExtensions.GetEndPoint(_address.Replace("11210", "11207")); var connectionPoolConfig = new PoolConfiguration { UseSsl = true, Uri = new Uri(ConfigurationManager.AppSettings["bootstrapUrl"]) }; _connectionPool = new ConnectionPool<SslConnection>(connectionPoolConfig, ipEndpoint); _connectionPool.Initialize(); _ioService = new PooledIOService(_connectionPool, null); }
public void SetUp() { FHClient.Init(); ioService = ServiceFinder.Resolve<IIOService>(); string dataDir = ioService.GetDataPersistDir(); dataPersistDir = Path.Combine(dataDir, "syncTestDir"); if(Directory.Exists(dataPersistDir)){ Directory.Delete(dataPersistDir); } dataPersistFile = Path.Combine(dataPersistDir, ".test_data_file"); Debug.WriteLine(String.Format("Data persist path = {0}", dataPersistFile)); }
public Include( XElement element, IncludeProperties properties, ITraceService trace, IIOService io) : this(element, () => properties, trace, io) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentNullException>(io != null); }
public Include( XElement element, Extension<IncludeProperties> properties, ITraceService trace, IIOService io) : base(element, () => properties.Value, trace, io) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentNullException>(io != null); }
public void Test_GetConfig_Non_Default_Bucket() { var saslMechanism = new PlainTextMechanism(_ioService, "authenticated", "secret", new DefaultTranscoder()); _ioService = new PooledIOService(_connectionPool, saslMechanism); var response = _ioService.Execute(new Config(new DefaultTranscoder(), OperationLifespan, _endPoint)); Assert.IsTrue(response.Success); Assert.IsNotNull(response.Value); Assert.AreEqual("authenticated", response.Value.Name); Console.WriteLine(response.Value.ToString()); }
public void TestFixtureSetUp() { _endPoint = UriExtensions.GetEndPoint(_address); var connectionPoolConfig = new PoolConfiguration { MinSize = 1, MaxSize = 1 }; _connectionPool = new ConnectionPool<Connection>(connectionPoolConfig, _endPoint); _ioService = new PooledIOService(_connectionPool); }
public void SetUp() { FHClient.Init(); _ioService = ServiceFinder.Resolve<IIOService>(); var dataDir = _ioService.GetDataPersistDir(); _dataPersistDir = Path.Combine(dataDir, "syncTestDir"); if (Directory.Exists(_dataPersistDir)) { Directory.Delete(_dataPersistDir); } _dataPersistFile = Path.Combine(_dataPersistDir, ".test_data_file"); Debug.WriteLine("Data persist path = {0}", _dataPersistFile); }
public ArtistVM(Artist artist, IAdministrationServices service, IIOService ioservice) { this.administrationService = service; this.ioService = ioservice; this.artist = artist; this.Catagories = new ObservableCollection<Catagory>(); this.Countries = new ObservableCollection<string>(); LoadData(); SaveCommand = new RelayCommand(async s => { if (!(await Validator.ValidateAllAsync()).IsValid) { return; } artist = administrationService.SaveArtist(artist); if (artist != null && artist.Id > 0) { AppMessages.ShowSuccessMessage.Send($"Artist {artist.Name} saved "); AppMessages.ArtistChanged.Send(AppMessages.ChangeType.Change); return; } AppMessages.ShowErrorMessage.Send($"Error occured while saving Artist {artist.Name} "); }); DeleteCommand = new RelayCommand(c => { if(artist.Id == null) { AppMessages.ArtistChanged.Send(AppMessages.ChangeType.Remove); return; } if (administrationService.DeleteArtist(artist)) { AppMessages.ShowSuccessMessage.Send($"Artist {artist.Name} removed "); AppMessages.ArtistChanged.Send(AppMessages.ChangeType.Remove); return; } AppMessages.ShowErrorMessage.Send($"Error occured while removing Artist {artist.Name} "); }); ChangePictureCommand = new RelayCommand(c => { this.artist.Picture = ioService.openFileBase64Encoded(); RaisePropertyChangedEvent(nameof(Picture)); }); AddValidationRules(); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="element"></param> /// <param name="properties"></param> /// <param name="trace"></param> /// <param name="io"></param> public Include( XElement element, Func<IncludeProperties> properties, ITraceService trace, IIOService io) : base(element) { Contract.Requires<ArgumentNullException>(element != null); Contract.Requires<ArgumentNullException>(properties != null); Contract.Requires<ArgumentNullException>(trace != null); Contract.Requires<ArgumentNullException>(io != null); this.properties = properties; this.trace = trace; this.io = io; }
/// <summary> /// For testing purposes only. /// </summary> internal SymbolSearchUpdateEngine( ISymbolSearchLogService logService, IRemoteControlService remoteControlService, IDelayService delayService, IIOService ioService, IPatchService patchService, IDatabaseFactoryService databaseFactoryService, Func<Exception, bool> reportAndSwallowException, CancellationToken updateCancellationToken) { _delayService = delayService; _ioService = ioService; _logService = logService; _remoteControlService = remoteControlService; _patchService = patchService; _databaseFactoryService = databaseFactoryService; _reportAndSwallowException = reportAndSwallowException; _updateCancellationToken = updateCancellationToken; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="ioService"></param> /// <param name="uri"></param> /// <param name="accept"></param> public static TextReader Create(IIOService ioService, Uri uri, MediaRangeList accept, Encoding encoding) { Contract.Requires<ArgumentNullException>(ioService != null); Contract.Requires<ArgumentNullException>(uri != null); var request = new IORequest(uri, IOMethod.Get) { Accept = accept, }; var response = ioService.Send(request); if (response.Status != IOStatus.Success) throw new IOException(); if (!response.ContentType.Matches(accept)) throw new IOException(); if (encoding != null) return new IOTextReader(uri, response.Content, encoding); else return new IOTextReader(uri, response.Content); }
/// <exception cref="CouchbaseBootstrapException">Condition.</exception> public void LoadConfig(IIOService ioService) { var supportsEnhancedDurability = false; try { Lock.EnterWriteLock(); Log.Info(m => m("o2-Creating the Servers list using rev#{0}", BucketConfig.Rev)); var queryUris = new ConcurrentBag<FailureCountingUri>(); var clientBucketConfig = ClientConfig.BucketConfigs[BucketConfig.Name]; var servers = new Dictionary<IPAddress, IServer>(); var nodes = BucketConfig.GetNodes(); foreach (var adapter in nodes) { var endpoint = adapter.GetIPEndPoint(clientBucketConfig.UseSsl); try { IServer server = null; if (Equals(ioService.EndPoint, endpoint) || nodes.Count() == 1) { server = new Core.Server(ioService, adapter, ClientConfig, BucketConfig, Transcoder, QueryCache); supportsEnhancedDurability = ioService.SupportsEnhancedDurability; SupportsEnhancedDurability = supportsEnhancedDurability; if (server.IsQueryNode) { var uri = UrlUtil.GetFailureCountingBaseUri(adapter, clientBucketConfig); uri.ConfigureServicePoint(ClientConfig); queryUris.Add(uri); } } else { if (adapter.IsQueryNode) { var uri = UrlUtil.GetFailureCountingBaseUri(adapter, clientBucketConfig); uri.ConfigureServicePoint(ClientConfig); queryUris.Add(uri); } if (adapter.IsDataNode) //a data node so create a connection pool { var poolConfiguration = ClientConfig.BucketConfigs[BucketConfig.Name].PoolConfiguration; var connectionPool = ConnectionPoolFactory(poolConfiguration, endpoint); var newIoService = IOServiceFactory(connectionPool); server = new Core.Server(newIoService, adapter, ClientConfig, BucketConfig, Transcoder, QueryCache) { SaslFactory = SaslFactory }; server.CreateSaslMechanismIfNotExists(); //Note: "ioService has" already made a HELO command to check if //the cluster supports enhanced durability so we are reusing the flag //instead of having "newIoService" do it again, later. SupportsEnhancedDurability = ioService.SupportsEnhancedDurability; } else { server = new Core.Server(null, adapter, ClientConfig, BucketConfig, Transcoder, QueryCache); } } servers.Add(endpoint.Address, server); } catch (Exception e) { Log.ErrorFormat("Could not add server {0}. Exception: {1}", endpoint, e); } } UpdateServices(servers); //for caching uri's Interlocked.Exchange(ref QueryUris, queryUris); Log.Info(m => m("Creating the KeyMapper list using rev#{0}", BucketConfig.Rev)); var old = Interlocked.Exchange(ref Servers, servers); var vBucketKeyMapper = new VBucketKeyMapper(Servers, BucketConfig.VBucketServerMap, BucketConfig.Rev); Interlocked.Exchange(ref KeyMapper, vBucketKeyMapper); if (old != null) { foreach (var server in old.Values) { server.Dispose(); } old.Clear(); } } finally { Lock.ExitWriteLock(); } }
/// <summary> /// Creates a <see cref="CramMd5Mechanism"/> object using a given <see cref="IOService"/>. /// </summary> /// <param name="ioService">The I/O service to use.</param> /// <param name="transcoder"></param> public CramMd5Mechanism(IIOService ioService, ITypeTranscoder transcoder, ILoggerFactory loggerFactory) { _ioService = ioService; _transcoder = transcoder; Log = loggerFactory.CreateLogger<CramMd5Mechanism>(); }