/// <summary> /// Exports the tenant. /// </summary> /// <remarks> /// This is the entry point for export requests that come via PlatformConfigure. c.f. EntityXmlExporter.GenerateXml. /// </remarks> /// <param name="tenantName">Name of the tenant.</param> /// <param name="entityId">Root entity to export.</param> /// <param name="packagePath">The package path.</param> /// <param name="exportSettings">Export settings.</param> /// <param name="context">The context.</param> public static void ExportEntity(string tenantName, long entityId, string packagePath, IProcessingContext context = null) { if (string.IsNullOrEmpty(tenantName)) { throw new ArgumentNullException(nameof(tenantName)); } if (string.IsNullOrEmpty(packagePath)) { throw new ArgumentNullException(nameof(packagePath)); } if (context == null) { context = new ProcessingContext( ); } context.Report.StartTime = DateTime.Now; long tenantId = TenantHelper.GetTenantId(tenantName, true); ///// // Create source to load app data from tenant ///// using (IDataTarget target = FileManager.CreateDataTarget(Format.XmlVer2, packagePath)) { var exporter = ( EntityXmlExporter )Factory.EntityXmlExporter; exporter.ExportEntity(tenantId, new[] { entityId }, target, context, false); } context.Report.EndTime = DateTime.Now; }
/// <summary> /// Interface for providing XML export. /// </summary> /// <remarks> /// This is the entry point for export requests that come via the console. c.f. EntityManager.ExportEntity. /// </remarks> /// <param name="entityIds">ID of entity to export.</param> /// <param name="xmlWriter">Xml Writer to write the exported entity to.</param> /// <param name="settings">Export settings.</param> public void GenerateXml(IEnumerable <long> entityIds, XmlWriter xmlWriter, EntityXmlExportSettings settings) { if (xmlWriter == null) { throw new ArgumentNullException(nameof(xmlWriter)); } if (settings == null) { settings = EntityXmlExportSettings.Default; } var context = new ProcessingContext( ); context.Report.StartTime = DateTime.Now; long tenantId = RequestContext.TenantId; ///// // Create source to load app data from tenant ///// using (IDataTarget target = CreateDataTarget(xmlWriter, settings)) { ExportEntity(tenantId, entityIds, target, context, true); } context.Report.EndTime = DateTime.Now; }
/// <summary> /// Create a source with initial stream to attach... /// </summary> /// <typeparam name="T"></typeparam> /// <param name="inStream"></param> /// <returns></returns> public T CreateSource <T>(IDataStream inStream) { // if it has a source, then use this, otherwise it's null and that works too. Reason: some sources like DataTable or SQL won't have an upstream source T src = CreateSource <T>(inStream.Source); IDataTarget srcDs = (IDataTarget)src; srcDs.In.Clear(); srcDs.In.Add(DataSource.DefaultStreamName, inStream); return(src); }
public StreamInfo(IDataStream strm, IDataTarget target, string inName) { try { Target = (target as IDataSource).DataSourceGuid; Source = strm.Source.DataSourceGuid; TargetIn = inName; foreach (var outStm in strm.Source.Out) if (outStm.Value == strm) SourceOut = outStm.Key; Count = strm.LightList.Count(); } catch { Error = true; } }
private static IService CreateService(string domain, string imageStore, ILogger logger, ICacheManager cacheManager, IFileSystemAbstraction fileSystem) { var dataProvider = new DataProvider(logger, domain, cacheManager, new NetworkAbstraction(logger)); var translationProvider = new TranslationProvider(dataProvider, logger); var parser = new Parser(logger, dataProvider, fileSystem, imageStore); var targets = new IDataTarget[] { new TemplateManagerTarget(logger), new TextFileTarget(logger, "skills.txt") }; return(new Service(logger, parser, targets, translationProvider, 1, 3500)); }
/// <summary> /// Implementation of exporting an entity. /// </summary> /// <remarks> /// This has been split to try and capture the common code shared by a PlatformConfigure export and a console export. /// </remarks> /// <param name="tenantId">The tenant</param> /// <param name="entityIds">The entity</param> /// <param name="target">The target</param> /// <param name="context">Processing context.</param> /// <param name="demandReadPermission">If true, perform a read demand as the current user.</param> internal void ExportEntity(long tenantId, IEnumerable <long> entityIds, IDataTarget target, IProcessingContext context, bool demandReadPermission) { using (IDataSource source = new TenantGraphSource { TenantId = tenantId, RootEntities = entityIds.ToList( ), DemandReadPermission = demandReadPermission }) { if (demandReadPermission) { CheckExportSecurity(source, context); } ///// // Copy the data ///// var processor = new CopyProcessor(source, target, context); processor.MigrateData( ); } }
/// <summary> /// Initializes a new instance of the <see cref="DataOperation"/> class. /// </summary> /// <param name="source">The source.</param> /// <param name="target">The target.</param> public DataOperation(IDataSource source, IDataTarget target) { if (source == null) { throw new ArgumentNullException("source"); } this.source = source; this.source.Parent = this; if (target == null) { throw new ArgumentNullException("target"); } this.target = target; this.target.Parent = this; this.timer = new Stopwatch(); }
/// <summary> /// Initializes a new instance of the <see cref="DumpInformationRepository" /> class. /// </summary> /// <param name="dataTarget">The data target.</param> /// <param name="runtime">The runtime.</param> /// <param name="dumpFile">The dump file.</param> /// <exception cref="ArgumentNullException">dataTarget</exception> /// <exception cref="System.ArgumentNullException">dataTarget</exception> public DumpInformationRepository(IDataTarget dataTarget, IClrRuntime runtime, FileInfo dumpFile) { CpuUtilization = runtime.ThreadPool.CpuUtilization; DumpFile = dumpFile; HeapCount = runtime.HeapCount; IsMiniDump = dataTarget?.IsMinidump ?? throw new ArgumentNullException(nameof(dataTarget)); IsServerGc = runtime.IsServerGc; MaxNumberFreeIoCompletionPorts = runtime.ThreadPool.MaxFreeCompletionPorts; MaxNumberIoCompletionPorts = runtime.ThreadPool.MaxCompletionPorts; MaxThreads = runtime.ThreadPool.MaxThreads; MinNumberIoCompletionPorts = runtime.ThreadPool.MinCompletionPorts; MinThreads = runtime.ThreadPool.MinThreads; NumberFreeIoCompletionPorts = runtime.ThreadPool.FreeCompletionPortCount; NumberIdleThreads = runtime.ThreadPool.IdleThreads; NumRunningThreads = runtime.ThreadPool.RunningThreads; ModuleInfosInternal = dataTarget?.EnumerateModules().ToList(); SymbolCache = dataTarget.SymbolLocator.SymbolCache; SymbolPath = dataTarget.SymbolLocator.SymbolPath; TotalHeapSize = runtime.Heap.TotalHeapSize; TotalThreads = runtime.ThreadPool.TotalThreads; StartTimeUtc = DateTime.UtcNow; }
/// <summary> /// Creates the data operation. /// </summary> /// <param name="connections">The connections.</param> /// <param name="operationElement">The operation element.</param> /// <returns>A DataOperation instance.</returns> private DataOperation CreateDataOperation(IEnumerable <DataConnection> connections, XElement operationElement) { var sourceElement = operationElement.Element("Source"); if (sourceElement == null) { throw new DataScriptException("Source element missing"); } var source = CreateSource(sourceElement, connections); var targetElement = operationElement.Element("Target"); if (targetElement == null) { throw new DataScriptException("Target element missing"); } IDataTarget target = this.CreateTarget(targetElement, connections); return(new DataOperation(source, target)); }
public SyncTask( string syncTaskId, IDataSource <TEntityA> dataSource, IDataTarget <TEntityA, TEntityB> dataTarget, ISyncStateStorage syncStateStorage, ISyncKeyMapStorage syncKeyMapStorage, Action <string, string, TEntityA, TEntityB, StateChange <TEntityA, TEntityB> > executeNestedTasks = null, string parentContextKey = null, bool failOnError = false, Action <TEntityA, TEntityB, Exception> failedCallback = null, Action <TEntityA, TEntityB> successCallback = null ) { SyncTaskId = syncTaskId; DataSource = dataSource; DataTarget = dataTarget; SyncStateStorage = syncStateStorage; SyncKeyMapStorage = syncKeyMapStorage; ExecuteNestedTasks = executeNestedTasks; ParentContextKey = parentContextKey; FailOnError = failOnError; _failedCallback = failedCallback; _successCallback = successCallback; }
public void SavePodcastAsXml(IPodcast podcast) { IDataTarget fileTarget = Factory.CreateFileTarget(); fileTarget.SavePodcast(podcast); }
public UsersController(IDataSource dataSource, IDataTarget dataTarget) { _dataSource = dataSource; _dataTarget = dataTarget; }
/// <summary> /// List with static properties and Test-Values /// </summary> /// <summary> /// The class constructor /// </summary> public DataTargetValueProvider(IDataTarget dataTarget) { _dataTarget = dataTarget; Name = "In"; }
/// <summary> /// Constructor /// </summary> /// <param name="source">The source.</param> /// <param name="target">The target.</param> /// <param name="context">The context.</param> public CopyProcessor(IDataSource source, IDataTarget target, IProcessingContext context) { DataSource = source; DataTarget = target; Context = context; }
/// <summary> /// Initializes a new instance of the <see cref="CopyProcessor" /> class. /// </summary> /// <param name="source">The source.</param> /// <param name="target">The target.</param> public CopyProcessor(IDataSource source, IDataTarget target) : this(source, target, null) { }
/// <summary> /// Initializes a new instance of the <see cref="DataTarget"/> class. /// </summary> /// <param name="target"> /// The target. /// </param> public DataTarget(IDataTarget target) { this.target = target; }