• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IBrightstarService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IBrightstarService的典型用法代码示例。如果您正苦于以下问题:C# IBrightstarService类的具体用法?C# IBrightstarService怎么用?C# IBrightstarService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IBrightstarService类属于命名空间,在下文中一共展示了IBrightstarService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SparqlResultModel

 public SparqlResultModel(string storeName, IBrightstarService service, SparqlRequestObject sparqlRequest, SparqlResultsFormat resultsFormat)
 {
     _storeName = storeName;
     _sparqlRequest = sparqlRequest;
     _service = service;
     ResultsFormat = resultsFormat;
 }
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:7,代码来源:SparqlResultModel.cs


示例2: SparqlModule

        public SparqlModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider permissionsProvider)
        {
            this.RequiresBrightstarStorePermission(permissionsProvider, get:StorePermissions.Read, post:StorePermissions.Read);
            _brightstar = brightstarService;

            Get["/{storeName}/sparql"] = parameters =>
                {
                    try
                    {
                        var requestObject = BindSparqlRequestObject();
                        return ProcessQuery(parameters["storeName"], requestObject);
                    }
                    catch (RdfParseException)
                    {
                        return HttpStatusCode.BadRequest;
                    }
                };
            Post["/{storeName}/sparql"] = parameters =>
                {
                    try
                    {
                        var requestObject = BindSparqlRequestObject();
                        return ProcessQuery(parameters["storeName"], requestObject);
                    }
                    catch (RdfParseException)
                    {
                        return HttpStatusCode.BadRequest;
                    }
                };
            Get["/{storeName}/commits/{commitId}/sparql"] = ProcessCommitPointQuery;
            Post["/{storeName}/commits/{commitId}/sparql"] = ProcessCommitPointQuery;
        }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:32,代码来源:SparqlModule.cs


示例3: BrightstarBootstrapper

 /// <summary>
 /// Creates a new bootstrapper that denies all anonymous access to the specified Brightstar service
 /// but grants all authenticated users full access to the service and all of its stores.
 /// </summary>
 /// <param name="brightstarService"></param>
 public BrightstarBootstrapper(IBrightstarService brightstarService)
     : this(
         brightstarService, 
     new FallbackStorePermissionsProvider(StorePermissions.All),
     new FallbackSystemPermissionsProvider(SystemPermissions.All))
 {
 }
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:12,代码来源:BrightstarBootstrapper.cs


示例4: TransactionsModule

        public TransactionsModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider storePermissionsProvider)
        {
            this.RequiresBrightstarStorePermission(storePermissionsProvider, get:StorePermissions.ViewHistory);

            Get["/{storeName}/transactions"] = parameters =>
                {
                    var transactionsRequest = this.Bind<TransactionsRequestObject>();
                    ViewBag.Title = transactionsRequest.StoreName + " - Transactions";
                    if (transactionsRequest.Take <= 0) transactionsRequest.Take = DefaultPageSize;
                    var transactions = brightstarService.GetTransactions(transactionsRequest.StoreName,
                                                                                 transactionsRequest.Skip,
                                                                                 transactionsRequest.Take + 1);
                    return Negotiate.WithPagedList(transactionsRequest,
                                                   transactions.Select(MakeResponseObject),
                                                   transactionsRequest.Skip, transactionsRequest.Take, DefaultPageSize,
                                                   "transactions");
                };

            Get["/{storeName}/transactions/byjob/{jobId}"] = parameters =>
                {
                    Guid jobId;
                    if (!Guid.TryParse(parameters["jobId"], out jobId))
                    {
                        return HttpStatusCode.NotFound;
                    }
                    var storeName = parameters["storeName"];
                    ViewBag.Title = storeName + " - Transaction - Job " + jobId;
                    var txn = brightstarService.GetTransaction(parameters["storeName"], jobId);
                    return txn == null ? HttpStatusCode.NotFound : MakeResponseObject(txn);
                };
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:31,代码来源:TransactionsModule.cs


示例5: AssertTriplePatternInGraph

 public static void AssertTriplePatternInGraph(IBrightstarService client, string storeName, string triplePattern,
                               string graphUri)
 {
     var sparql = "ASK { GRAPH <" + graphUri + "> {" + triplePattern + "}}";
     var resultsDoc = XDocument.Load(client.ExecuteQuery(storeName, sparql));
     Assert.IsTrue(resultsDoc.SparqlBooleanResult());
 }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:7,代码来源:ClientTestBase.cs


示例6: StoreModule

        public StoreModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider storePermissionsProvider)
        {
            this.RequiresBrightstarStorePermission(storePermissionsProvider, get:StorePermissions.Read, delete:StorePermissions.Admin);

            Get["/{storeName}"] = parameters =>
            {
                var storeName = parameters["storeName"];
                ViewBag.Title = storeName;

                if (!brightstarService.DoesStoreExist(storeName)) return HttpStatusCode.NotFound;
                if (Request.Method.ToUpperInvariant() == "HEAD")
                {
                    IEnumerable < ICommitPointInfo > commitPoints = brightstarService.GetCommitPoints(storeName, 0, 1);
                    var commit = commitPoints.First();
                    return
                        Negotiate.WithHeader("Last-Modified", commit.CommitTime.ToUniversalTime().ToString("r"))
                            .WithStatusCode(HttpStatusCode.OK)
                            .WithModel(new StoreResponseModel(parameters["storeName"]));
                }
                return new StoreResponseModel(parameters["storeName"]);
            };

            Delete["/{storeName}"] = parameters =>
                {
                    var storeName = parameters["storeName"];
                    ViewBag.Title = "Deleted - " + storeName;
                    if (brightstarService.DoesStoreExist(storeName))
                    {
                        brightstarService.DeleteStore(storeName);
                    }
                    return Negotiate.WithMediaRangeModel(new MediaRange("text/html"), 
                                                         new StoreDeletedModel {StoreName = storeName});
                };
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:34,代码来源:StoreModule.cs


示例7: AssertTriplePatternNotInDefaultGraph

 public static void AssertTriplePatternNotInDefaultGraph(IBrightstarService client, string storeName,
                                                       string triplePattern)
 {
     var sparql = "ASK {{" + triplePattern + "}}";
     var resultsDoc = XDocument.Load(client.ExecuteQuery(storeName, sparql));
     Assert.IsFalse(resultsDoc.SparqlBooleanResult());
 }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:7,代码来源:ClientTestBase.cs


示例8: CreateServiceHost

        public ServiceHost CreateServiceHost(IBrightstarService service, EventHandler onCloseEventHandler)
        {
            var httpPort = Configuration.HttPort;
            var tcpPort = Configuration.TcpPort;
            var pipeName = Configuration.NamedPipeName;

            var serviceHost = new ServiceHost(service, new[] {   new Uri(string.Format("http://localhost:{0}/brightstar", httpPort)) , 
                                                                                 new Uri(string.Format("net.tcp://localhost:{0}/brightstar", tcpPort)),
                                                                                 new Uri(string.Format("net.pipe://localhost/{0}", pipeName)) });

            var basicHttpBinding = new BasicHttpContextBinding { TransferMode = TransferMode.StreamedResponse, MaxReceivedMessageSize = int.MaxValue, SendTimeout = TimeSpan.FromMinutes(30), ReaderQuotas = XmlDictionaryReaderQuotas.Max, Namespace = "http://www.networkedplanet.com/schemas/brightstar" };
            var netTcpContextBinding = new NetTcpContextBinding { TransferMode = TransferMode.StreamedResponse, MaxReceivedMessageSize = int.MaxValue, SendTimeout = TimeSpan.FromMinutes(30), ReaderQuotas = XmlDictionaryReaderQuotas.Max, Namespace = "http://www.networkedplanet.com/schemas/brightstar" };
            var netNamedPipeBinding = new NetNamedPipeBinding { TransferMode = TransferMode.StreamedResponse, MaxReceivedMessageSize = int.MaxValue, SendTimeout = TimeSpan.FromMinutes(30), ReaderQuotas = XmlDictionaryReaderQuotas.Max, Namespace = "http://www.networkedplanet.com/schemas/brightstar" };

            serviceHost.AddServiceEndpoint(typeof(IBrightstarService), basicHttpBinding, "");
            serviceHost.AddServiceEndpoint(typeof(IBrightstarService), netTcpContextBinding, "");
            serviceHost.AddServiceEndpoint(typeof(IBrightstarService), netNamedPipeBinding, "");

            var throttlingBehavior = new ServiceThrottlingBehavior { MaxConcurrentCalls = int.MaxValue };

            serviceHost.Description.Behaviors.Add(new ServiceMetadataBehavior { HttpGetEnabled = true });
            serviceHost.Description.Behaviors.Add(throttlingBehavior);

            serviceHost.Closed += onCloseEventHandler;

            return serviceHost;
        }
开发者ID:phatcher,项目名称:BrightstarDB,代码行数:27,代码来源:BrightstarServiceHostFactory.cs


示例9: SparqlQueryProcessingModel

 public SparqlQueryProcessingModel(string storeName, IBrightstarService service, SparqlRequestObject sparqlRequest)
 {
     _storeName = storeName;
     _service = service;
     _sparqlRequest = sparqlRequest;
     ResultModel = sparqlRequest.Query == null ? SerializableModel.None : SparqlQueryHelper.GetResultModel(sparqlRequest.Query);
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:7,代码来源:SparqlQueryProcessingModel.cs


示例10: SparqlQueryProcessingModel

 public SparqlQueryProcessingModel(string storeName, ulong commitId, IBrightstarService service,
                                   SparqlRequestObject sparqlRequest)
 {
     _storeName = storeName;
     _commitId = commitId;
     _service = service;
     _sparqlRequest = sparqlRequest;
 }
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:8,代码来源:SparqlQueryProcessingModel.cs


示例11: FakeNancyBootstrapper

 public FakeNancyBootstrapper(IBrightstarService brightstarService,
                              AbstractStorePermissionsProvider storePermissionsProvider,
     AbstractSystemPermissionsProvider systemPermissionsProvider)
 {
     _brightstarService = brightstarService;
     _storePermissionsProvider = storePermissionsProvider;
     _systemPermissionsProvider = systemPermissionsProvider;
 }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:8,代码来源:FakeNancyBootstrapper.cs


示例12: AssertJobCompletesSuccessfully

 public static void AssertJobCompletesSuccessfully(IBrightstarService client, string storeName, IJobInfo job)
 {
     while (!job.JobCompletedOk && !job.JobCompletedWithErrors)
     {
         Task.Delay(10).Wait();
         job = client.GetJobInfo(storeName, job.JobId);
     }
     Assert.IsTrue(job.JobCompletedOk, "Expected job to complete successfully, but it failed with message '{0}' : {1}", job.StatusMessage, job.ExceptionInfo);
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:9,代码来源:TestHelper.cs


示例13: BrightstarBootstrapper

 /// <summary>
 /// Creates a new bootstrapper that denies all anonymous access to the specified Brightstar service
 /// but grants all authenticated users full access to the service and all of its stores.
 /// </summary>
 /// <param name="brightstarService"></param>
 /// <param name="authenticationProviders">An enumeration of the authentication providers to be used by the service</param>
 public BrightstarBootstrapper(IBrightstarService brightstarService,
                               IEnumerable<IAuthenticationProvider> authenticationProviders)
     : this(
         brightstarService,
         authenticationProviders,
         new FallbackStorePermissionsProvider(StorePermissions.All),
         new FallbackSystemPermissionsProvider(SystemPermissions.All))
 {
 }
开发者ID:kowalot,项目名称:BrightstarDB,代码行数:15,代码来源:BrightstarBootstrapper.cs


示例14: AssertJobSuccessful

 protected void AssertJobSuccessful(IBrightstarService client,string storeName, IJobInfo job)
 {
     while (!(job.JobCompletedOk || job.JobCompletedWithErrors))
     {
         Task.Delay(3).Wait();
         job = client.GetJobInfo(storeName, job.JobId);
     }
     Assert.IsTrue(job.JobCompletedOk, "Job failed with message: {0} : {1}", job.StatusMessage, job.ExceptionInfo);
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:9,代码来源:StoreTestsBase.cs


示例15: LatestStatisticsModule

 public LatestStatisticsModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider storePermissionsProvider)
 {
     this.RequiresBrightstarStorePermission(storePermissionsProvider, get:StorePermissions.Read);
     Get["/{storeName}/statistics/latest"] = parameters =>
         {
             var latest = brightstarService.GetStatistics(parameters["storeName"]);
             if (latest == null) return HttpStatusCode.NotFound;
             return MakeResponseModel(latest);
         };
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:10,代码来源:LatestStatisticsModule.cs


示例16: SparqlResultModel

 public SparqlResultModel(string storeName, ulong commitId, IBrightstarService service,
                          SparqlRequestObject sparqlRequest, SparqlResultsFormat resultsFormat, RdfFormat graphFormat)
 {
     _storeName = storeName;
     _commitId = commitId;
     _sparqlRequest = sparqlRequest;
     _service = service;
     ResultsFormat = resultsFormat;
     GraphFormat = graphFormat;
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:10,代码来源:SparqlResultModel.cs


示例17: StoresModule

        public StoresModule(IBrightstarService brightstarService, AbstractSystemPermissionsProvider systemPermissionsProvider)
        {
            this.RequiresBrightstarSystemPermission(systemPermissionsProvider, get:SystemPermissions.ListStores, post:SystemPermissions.CreateStore);

            Get["/"] = parameters =>
            {
                ViewBag.Title = "Stores";
                var stores = brightstarService.ListStores();
                return
                    Negotiate.WithModel(new StoresResponseModel
                        {
                            Stores = stores.ToList()
                        });
                };

            Post["/"] = parameters =>
                {
                    ViewBag.Title = "Stores";
                    var request = this.Bind<CreateStoreRequestObject>();
                    if (request == null || String.IsNullOrEmpty(request.StoreName))
                    {
                        return HttpStatusCode.BadRequest;
                    }

                    // Return 409 Conflict if attempt to create a store with a name that is currently in use
                    if (brightstarService.DoesStoreExist(request.StoreName))
                    {
                        return HttpStatusCode.Conflict;
                    }

                    // Attempt to create the store
                    try
                    {
                        PersistenceType? storePersistenceType = request.GetBrightstarPersistenceType();
                        if (storePersistenceType.HasValue)
                        {
                            brightstarService.CreateStore(request.StoreName, storePersistenceType.Value);
                        }
                        else
                        {
                            brightstarService.CreateStore(request.StoreName);
                        }
                    }
                    catch (ArgumentException)
                    {
                        return HttpStatusCode.BadRequest;   
                    }
                    return
                        Negotiate.WithModel(new StoreResponseModel(request.StoreName))
                                 .WithStatusCode(HttpStatusCode.Created);
                };
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:52,代码来源:StoresModule.cs


示例18: CommitPointsModule

        public CommitPointsModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider permissionsProvider)
        {
            this.RequiresBrightstarStorePermission(permissionsProvider, get:StorePermissions.ViewHistory, post:StorePermissions.Admin);

            Get["/{storeName}/commits"] = parameters =>
                {
                    int skip = Request.Query["skip"].TryParse<int>(0);
                    int take = Request.Query["take"].TryParse<int>(DefaultPageSize);
                    DateTime timestamp = Request.Query["timestamp"].TryParse<DateTime>();
                    DateTime earliest = Request.Query["earliest"].TryParse<DateTime>();
                    DateTime latest = Request.Query["latest"].TryParse<DateTime>();

                    var request = this.Bind<CommitPointsRequestModel>();
                    ViewBag.Title = request.StoreName + " - Commit History";
                    
                    if (timestamp != default(DateTime))
                    {
                        // Request for a single commit point
                        var commitPoint = brightstarService.GetCommitPoint(parameters["storeName"], timestamp);
                        return commitPoint == null ? HttpStatusCode.NotFound : MakeResponseObject(commitPoint);
                    }
                    if (earliest != default(DateTime) && latest != default(DateTime))
                    {
                        IEnumerable<ICommitPointInfo> results =
                            brightstarService.GetCommitPoints(parameters["storeName"], latest, earliest, skip, take + 1);
                        var resourceUri = String.Format("commits?latest={0}&earliest={1}", latest.ToString("s"), earliest.ToString("s"));
                        return Negotiate.WithPagedList(request, results.Select(MakeResponseObject), skip, take, DefaultPageSize, resourceUri);
                    }
                    IEnumerable<ICommitPointInfo> commitPointInfos = brightstarService.GetCommitPoints(parameters["storeName"], skip, take + 1);
                    return Negotiate.WithPagedList(request, commitPointInfos.Select(MakeResponseObject), skip, take, DefaultPageSize, "commits");
                };

            Post["/{storeName}/commits"] = parameters =>
                {
                    var commitPoint = this.Bind<CommitPointResponseModel>();
                    if (commitPoint == null ||
                        String.IsNullOrEmpty(commitPoint.StoreName) ||
                        !commitPoint.StoreName.Equals(parameters["storeName"]))
                    {
                        return HttpStatusCode.BadRequest;
                    }

                    var commitPointInfo = brightstarService.GetCommitPoint(parameters["storeName"], commitPoint.Id);
                    if (commitPointInfo == null) return HttpStatusCode.BadRequest;

                    brightstarService.RevertToCommitPoint(parameters["storeName"], commitPointInfo);
                    return HttpStatusCode.OK;
                };
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:49,代码来源:CommitPointsModule.cs


示例19: WaitForJob

 public static IJobInfo WaitForJob(IJobInfo job, IBrightstarService client, string storeName)
 {
     var cycleCount = 0;
     while (!job.JobCompletedOk && !job.JobCompletedWithErrors && cycleCount < 100)
     {
         Thread.Sleep(500);
         cycleCount++;
         job = client.GetJobInfo(storeName, job.JobId);
     }
     if (!job.JobCompletedOk && !job.JobCompletedWithErrors)
     {
         Assert.Fail("Job did not complete in time.");
     }
     return job;
 }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:15,代码来源:ClientTestBase.cs


示例20: RunCompressJob

 static bool RunCompressJob(IBrightstarService client, string storeName, out string finalMessage)
 {
     var compressJob = client.ConsolidateStore(storeName);
     while (!(compressJob.JobCompletedOk || compressJob.JobCompletedWithErrors))
     {
         System.Threading.Thread.Sleep(1000);
         compressJob = client.GetJobInfo(storeName, compressJob.JobId);
     }
     finalMessage = compressJob.StatusMessage;
     if (compressJob.ExceptionInfo != null)
     {
         finalMessage += " Exception Detail:" + compressJob.ExceptionInfo;
     }
     return compressJob.JobCompletedOk;
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:15,代码来源:Compress.cs



注:本文中的IBrightstarService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IBrokerage类代码示例发布时间:2022-05-24
下一篇:
C# IBranch类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap