本文整理汇总了C#中IBrightstarService类的典型用法代码示例。如果您正苦于以下问题:C# IBrightstarService类的具体用法?C# IBrightstarService怎么用?C# IBrightstarService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBrightstarService类属于命名空间,在下文中一共展示了IBrightstarService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SparqlResultModel
public SparqlResultModel(string storeName, IBrightstarService service, SparqlRequestObject sparqlRequest, SparqlResultsFormat resultsFormat)
{
_storeName = storeName;
_sparqlRequest = sparqlRequest;
_service = service;
ResultsFormat = resultsFormat;
}
示例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;
}
示例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))
{
}
示例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);
};
}
示例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());
}
示例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});
};
}
示例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());
}
示例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;
}
示例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);
}
示例10: SparqlQueryProcessingModel
public SparqlQueryProcessingModel(string storeName, ulong commitId, IBrightstarService service,
SparqlRequestObject sparqlRequest)
{
_storeName = storeName;
_commitId = commitId;
_service = service;
_sparqlRequest = sparqlRequest;
}
示例11: FakeNancyBootstrapper
public FakeNancyBootstrapper(IBrightstarService brightstarService,
AbstractStorePermissionsProvider storePermissionsProvider,
AbstractSystemPermissionsProvider systemPermissionsProvider)
{
_brightstarService = brightstarService;
_storePermissionsProvider = storePermissionsProvider;
_systemPermissionsProvider = systemPermissionsProvider;
}
示例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);
}
示例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))
{
}
示例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);
}
示例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);
};
}