4using System.Threading.Tasks;
26 public const string SourceID =
"PreviewIdApplications";
28 private static readonly Dictionary<string, PreviewIdApplication> applications =
29 new Dictionary<string, PreviewIdApplication>();
30 private static DateTime loaded = DateTime.MinValue;
93 case "ServerSignature":
95 case "ClientSignature":
99 return Task.FromResult(
true);
102 return Task.FromResult(
false);
124 private static InvalidOperationException InvalidOperation()
126 return new InvalidOperationException(
"The source is read-only.");
141 KeyValuePair<VariableReference, bool>[] Order,
ScriptNode Node)
143 throw InvalidOperation();
151 public Task
Update(
bool Lazy, IEnumerable<object> Objects) =>
throw InvalidOperation();
158 public Task
Insert(
bool Lazy,
object Object) =>
throw InvalidOperation();
193 if (!Processor.
Process(e.Current))
214 public async Task<IResultSetEnumerator>
Find(
int Offset,
int Top,
bool Generic,
222 DateTime TP = DateTime.UtcNow;
225 if (TP.Subtract(loaded).TotalDays >= 1)
227 applications.Clear();
230 string[] PreviewApplications = Directory.GetFiles(PreviewFolder,
"*.id",
231 SearchOption.TopDirectoryOnly);
233 for (i = 0, c = PreviewApplications.Length; i < c; i++)
235 string FileName = PreviewApplications[i];
237 File.GetCreationTimeUtc(FileName),
238 File.GetLastAccessTimeUtc(FileName));
243 if (!(Identity is
null))
244 applications[FileName] = Application;
254 c = applications.Count;
259 Applications[i++] = Application.Clone(
Variables, Node);
270 internal static async Task PreviewFileSaved(
string FileName,
LegalIdentity Identity)
273 File.GetCreationTimeUtc(FileName),
274 File.GetLastAccessTimeUtc(FileName),
279 applications[FileName] = Application;
282 internal static async Task PreviewFileDeleted(
string FileName)
286 applications.Remove(FileName);
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Represents a named semaphore, i.e. an object, identified by a name, that allows single concurrent wri...
Static class of application-wide semaphores that can be used to order access to editable objects.
static async Task< Semaphore > BeginWrite(string Key)
Waits until the semaphore identified by Key is ready for writing. Each call to BeginWrite must be fo...
Base class for all nodes in a parsed script tree.
Data Source defined by a vector.
Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
Preview of an ID Application.
A data source for ID Application previews.
Task< int?> Delete(bool Lazy, int Offset, int Top, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Deletes a set of objects.
async Task< bool > Process(IProcessor< object > Processor, int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Processes objects matching filter conditions in Where .
Grade Supports(string Name)
How well the source supports the object specified by Name .
async Task< IResultSetEnumerator > Find(int Offset, int Top, bool Generic, ScriptNode Where, Variables Variables, KeyValuePair< VariableReference, bool >[] Order, ScriptNode Node)
Finds objects matching filter conditions in Where .
string Name
Collection name or alias.
Task Insert(bool Lazy, object Object)
Inserts an object.
Task Update(bool Lazy, IEnumerable< object > Objects)
Updates a set of objects.
Task DropCollection()
Drops the collection specified by the source.
string TypeName
Name of corresponding type.
Task< bool > IsLabel(string Label)
Checks if the label is a label in the source.
string CollectionName
Name of corresponding collection.
const string SourceID
Name of the source (PreviewIdApplications)
PreviewIdApplicationSource()
A data source for ID Application previews.
Task< bool > DropIndex(string Name)
Drops an index from the source.
bool IsSource(string Name)
Checks if the name refers to the source.
Task CreateIndex(string Name, string[] Fields)
Creates an index in the source.
Legal (digital identities, smart contracts) service component.
static string GetPreviewFolder()
Returns the folder where previewed files are stored. If the folder does not exist,...
Task< bool > MoveNextAsync()
Advances the enumerator to the next element of the collection.
Interface for processors of objects.
bool Process(T Object)
Processes an object synchronously.
bool Flush()
Called at the end of processing, to allow for flushing of buffers, etc.
bool IsAsynchronous
If the processor operates asynchronously.
Task< bool > FlushAsync()
Called at the end of processing, to allow for flushing of buffers, etc.
Task< bool > ProcessAsync(T Object)
Processes an object asynchronously.
Interface for result-set enumerators.
Interface for named data sources that can be used in SQL statements.