public LocalExpressionPlan(LocalProcess process, IRemoteServerExpressionPlan plan, PlanDescriptor planDescriptor, DataParams paramsValue) : base(process, plan, planDescriptor) { _plan = plan; _params = paramsValue; _internalPlan = new Plan(_process._internalProcess); GetDataType(); }
public void ClassLoaderMissed(LocalProcess process, ClassLoader classLoader, ClassDefinition classDefinition) { AcquireCacheLock(process, LockMode.Exclusive); try { if (!classLoader.Classes.Contains(classDefinition.ClassName)) { // The local process has attempted to create an object from an unknown class alias. // Use the remote server to attempt to download and install the necessary assemblies. // Retrieve the list of all files required to load the assemblies required to load the class. ServerFileInfo[] fileInfos = process.RemoteProcess.GetFileNames(classDefinition.ClassName, process.Session.SessionInfo.Environment); for (int index = 0; index < fileInfos.Length; index++) { if (fileInfos[index].IsDotNetAssembly) { LoadAndRegister(process, classLoader, fileInfos[index].LibraryName, fileInfos[index].FileName, fileInfos[index].ShouldRegister); } } } } finally { ReleaseCacheLock(process, LockMode.Exclusive); } }
public static Assembly LoadAssembyFromRemote(LocalProcess process, string libraryName, string fileName) { using (Stream sourceStream = new RemoteStreamWrapper(process.RemoteProcess.GetFile(libraryName, fileName))) { var assembly = new System.Windows.AssemblyPart().Load(sourceStream); ReflectionUtility.RegisterAssembly(assembly); return(assembly); } }
public string GetFile(LocalProcess AProcess, string ALibraryName, string AFileName, DateTime AFileDate, bool AIsDotNetAssembly, out bool AShouldLoad) { AShouldLoad = false; string LFullFileName = GetLocalFileName(ALibraryName, AFileName, AIsDotNetAssembly); if (!_filesCached.Contains(AFileName)) { if (!File.Exists(LFullFileName) || (File.GetLastWriteTimeUtc(LFullFileName) < AFileDate)) { #if LOGFILECACHEEVENTS if (!File.Exists(LFullFileName)) { _internalServer.LogMessage(String.Format(@"Downloading file ""{0}"" from server because it does not exist on the client.", LFullFileName)); } else { _internalServer.LogMessage(String.Format(@"Downloading newer version of file ""{0}"" from server. Client write time: ""{1}"". Server write time: ""{2}"".", LFullFileName, File.GetLastWriteTimeUtc(LFullFileName), AFileDate.ToString())); } #endif using (Stream LSourceStream = new RemoteStreamWrapper(AProcess.RemoteProcess.GetFile(ALibraryName, AFileName))) { Alphora.Dataphor.Windows.FileUtility.EnsureWriteable(LFullFileName); try { using (FileStream LTargetStream = File.Open(LFullFileName, FileMode.Create, FileAccess.Write, FileShare.None)) { StreamUtility.CopyStreamWithBufferSize(LSourceStream, LTargetStream, FileCopyBufferSize); } File.SetLastWriteTimeUtc(LFullFileName, AFileDate); } catch (IOException E) { _internalServer.LogError(E); } } #if LOGFILECACHEEVENTS _internalServer.LogMessage("Download complete"); #endif } _filesCached.Add(AFileName); // Indicate that the assembly should be loaded if (AIsDotNetAssembly) { AShouldLoad = true; } } return(LFullFileName); }
public void LoadAndRegister(LocalProcess process, ClassLoader classLoader, string libraryName, string fileName, bool shouldRegister) { try { if (!_filesCached.Contains(fileName)) { Assembly assembly = LoadAssembyFromRemote(process, libraryName, fileName); if (shouldRegister && !classLoader.Assemblies.Contains(assembly.FullName)) { classLoader.RegisterAssembly(Catalog.LoadedLibraries[Engine.SystemLibraryName], assembly); } _assembliesCached.Add(fileName); _filesCached.Add(fileName); } } catch (IOException E) { _internalServer.LogError(E); } }
public void ClassLoaderMissed(LocalProcess AProcess, ClassLoader AClassLoader, ClassDefinition AClassDefinition) { AcquireCacheLock(AProcess, LockMode.Exclusive); try { if (!AClassLoader.Classes.Contains(AClassDefinition.ClassName)) { // The local process has attempted to create an object from an unknown class alias. // Use the remote server to attempt to download and install the necessary assemblies. //string AFullClassName = AProcess.RemoteProcess.GetClassName(AClassDefinition.ClassName); // BTR 5/17/2004 -> As far as I can tell, this doesn't do anything // Retrieve the list of all files required to load the assemblies required to load the class. ServerFileInfo[] LFileInfos = AProcess.RemoteProcess.GetFileNames(AClassDefinition.ClassName, AProcess.Session.SessionInfo.Environment); string[] LFullFileNames = new string[LFileInfos.Length]; for (int LIndex = 0; LIndex < LFileInfos.Length; LIndex++) { bool LShouldLoad; string LFullFileName = GetFile(AProcess, LFileInfos[LIndex].LibraryName, LFileInfos[LIndex].FileName, LFileInfos[LIndex].FileDate, LFileInfos[LIndex].IsDotNetAssembly, out LShouldLoad); // Register/Load the assembly if necessary if ((LFileInfos[LIndex].ShouldRegister || LShouldLoad) && !_assembliesCached.Contains(LFileInfos[LIndex].FileName)) { Assembly LAssembly = Assembly.LoadFrom(LFullFileName); ReflectionUtility.RegisterAssembly(LAssembly); if (LFileInfos[LIndex].ShouldRegister && !AClassLoader.Assemblies.Contains(LAssembly.FullName)) { AClassLoader.RegisterAssembly(Catalog.LoadedLibraries[Engine.SystemLibraryName], LAssembly); } _assembliesCached.Add(LFileInfos[LIndex].FileName); } } } } finally { ReleaseCacheLock(AProcess, LockMode.Exclusive); } }
public LocalStatementPlan(LocalProcess process, IRemoteServerStatementPlan plan, PlanDescriptor planDescriptor) : base(process, plan, planDescriptor) { _plan = plan; }
public LocalPlan(LocalProcess process, IRemoteServerPlan plan, PlanDescriptor planDescriptor) : base() { _process = process; _plan = plan; _descriptor = planDescriptor; }
public LocalExpressionPlan(LocalProcess process, IRemoteServerExpressionPlan plan, PlanDescriptor planDescriptor, DataParams paramsValue, ProgramStatistics executeTime) : this(process, plan, planDescriptor, paramsValue) { _programStatistics = executeTime; _programStatisticsCached = true; }
public LocalScript(LocalProcess process, IRemoteServerScript script) : base() { _process = process; _script = script; }