Esempio n. 1
0
 public IRemoteServerCursor OpenCursor(string expression, ref RemoteParamData paramsValue, out IRemoteServerExpressionPlan plan, out PlanDescriptor planDescriptor, out ProgramStatistics executeTime, ProcessCallInfo callInfo, RemoteProcessCleanupInfo cleanupInfo, out Guid[] bookmarks, int count, out RemoteFetchData fetchData)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginOpenCursorWithFetch(ProcessHandle, GetCleanupInfo(cleanupInfo), callInfo, expression, paramsValue, count, null, null);
         result.AsyncWaitHandle.WaitOne();
         DirectCursorWithFetchResult cursorResult = channel.EndOpenCursorWithFetch(result);
         paramsValue.Data = cursorResult.ParamData;
         planDescriptor   = cursorResult.PlanDescriptor;
         executeTime      = cursorResult.ExecuteTime;
         bookmarks        = cursorResult.Bookmarks;
         fetchData        = cursorResult.FetchData;
         plan             = new ClientExpressionPlan(this, planDescriptor);
         return(new ClientCursor((ClientExpressionPlan)plan, cursorResult.CursorDescriptor));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 2
0
 public IRemoteServerPlan Prepare(RemoteParam[] paramsValue)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginPrepareBatch(BatchHandle, paramsValue, null, null);
         result.AsyncWaitHandle.WaitOne();
         PlanDescriptor planDescriptor = channel.EndPrepareBatch(result);
         if (IsExpression())
         {
             return(new ClientExpressionPlan(_clientScript.ClientProcess, planDescriptor));
         }
         else
         {
             return(new ClientStatementPlan(_clientScript.ClientProcess, planDescriptor));
         }
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 3
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         try
         {
             var          channel = GetServiceInterface();
             IAsyncResult result  = channel.BeginCloseStream(_streamHandle, null, null);
             result.AsyncWaitHandle.WaitOne();
             channel.EndCloseStream(result);
         }
         catch (FaultException <DataphorFault> fault)
         {
             throw DataphorFaultUtility.FaultToException(fault.Detail);
         }
         catch (CommunicationException ce)
         {
             ReportCommunicationError();
             throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Esempio n. 4
0
 public IRemoteServerCursor Open(ref RemoteParamData paramsValue, out ProgramStatistics executeTime, out Guid[] bookmarks, int count, out RemoteFetchData fetchData, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginOpenPlanCursorWithFetch(PlanHandle, callInfo, paramsValue, count, null, null);
         result.AsyncWaitHandle.WaitOne();
         CursorWithFetchResult cursorResult = channel.EndOpenPlanCursorWithFetch(result);
         executeTime        = cursorResult.ExecuteTime;
         _programStatistics = executeTime;
         paramsValue.Data   = cursorResult.ParamData;
         bookmarks          = cursorResult.Bookmarks;
         fetchData          = cursorResult.FetchData;
         return(new ClientCursor(this, cursorResult.CursorDescriptor));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
        internal PlanDescriptor GetPlanDescriptor(IRemoteServerStatementPlan plan)
        {
            PlanDescriptor descriptor = new PlanDescriptor();

            descriptor.ID             = plan.ID;
            descriptor.CacheTimeStamp = plan.Process.Session.Server.CacheTimeStamp;
            descriptor.Statistics     = plan.PlanStatistics;
            descriptor.Messages       = DataphorFaultUtility.ExceptionsToFaults(plan.Messages);
            return(descriptor);
        }
Esempio n. 6
0
 public void Stop()
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginStop(null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndStop(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
 }
Esempio n. 7
0
        public ClientScript(ClientProcess clientProcess, ScriptDescriptor scriptDescriptor)
        {
            _clientProcess    = clientProcess;
            _scriptDescriptor = scriptDescriptor;

            _messages = new Exception[_scriptDescriptor.Messages.Count];
            for (int index = 0; index < _scriptDescriptor.Messages.Count; index++)
            {
                _messages[index] = DataphorFaultUtility.FaultToException(_scriptDescriptor.Messages[index]);
            }

            foreach (BatchDescriptor batchDescriptor in _scriptDescriptor.Batches)
            {
                _clientBatches.Add(new ClientBatch(this, batchDescriptor));
            }
        }
Esempio n. 8
0
 public RemoteProposeData Validate(RemoteRowBody oldRow, RemoteRowBody newRow, string column, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginValidate(CursorHandle, callInfo, oldRow, newRow, column, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndValidate(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 9
0
 public void DisposeBookmarks(Guid[] bookmarks, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginDisposeBookmarks(CursorHandle, callInfo, bookmarks, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndDisposeBookmarks(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 10
0
 public void Update(RemoteRow row, System.Collections.BitArray valueFlags, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginUpdate(CursorHandle, callInfo, row, valueFlags, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndUpdate(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 11
0
 public void Relinquish(IRemoteServerConnection connection)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginCloseConnection(((ClientConnection)connection).ConnectionHandle, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndCloseConnection(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 12
0
 public IRemoteServerConnection Establish(string connectionName, string hostName)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginOpenConnection(connectionName, hostName, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(new ClientConnection(this, connectionName, hostName, channel.EndOpenConnection(result)));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 13
0
 public void StopProcess(IRemoteServerProcess process)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginStopProcess(((ClientProcess)process).ProcessHandle, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndStopProcess(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 14
0
 public void Close(IRemoteServerCursor cursor, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginCloseCursor(((ClientCursor)cursor).CursorHandle, callInfo, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndCloseCursor(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 15
0
 public RemoteRowBody Select(ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginSelect(CursorHandle, callInfo, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndSelect(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 16
0
 public IRemoteServerSession Connect(SessionInfo sessionInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginConnect(_connectionHandle, sessionInfo, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(new ClientSession(this, sessionInfo, channel.EndConnect(result)));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 17
0
 public Stream Open(StreamID streamID, LockMode mode)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginOpenStream(ProcessHandle, streamID, mode, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(new ClientStream(this, channel.EndOpenStream(result)));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 18
0
 public void CommitApplicationTransaction(Guid iD, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginCommitApplicationTransaction(ProcessHandle, callInfo, iD, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndCommitApplicationTransaction(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 19
0
 public Guid BeginApplicationTransaction(bool shouldJoin, bool isInsert, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginBeginApplicationTransaction(ProcessHandle, callInfo, shouldJoin, isInsert, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndBeginApplicationTransaction(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 20
0
 public void Deallocate(StreamID streamID)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginDeallocateStream(ProcessHandle, streamID, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndDeallocateStream(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 21
0
 public Alphora.Dataphor.DAE.Server.ServerFileInfo[] GetFileNames(string className, string environment)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginGetFileNames(ProcessHandle, className, environment, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndGetFileNames(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 22
0
 public IRemoteStream GetFile(string libraryName, string fileName)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginGetFile(ProcessHandle, libraryName, fileName, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(new ClientStream(this, channel.EndGetFile(result)));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 23
0
 public IRemoteServerScript PrepareScript(string script, DebugLocator locator)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginPrepareScript(ProcessHandle, script, locator, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(new ClientScript(this, channel.EndPrepareScript(result)));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 24
0
 public void UnprepareScript(IRemoteServerScript script)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginUnprepareScript(((ClientScript)script).ScriptHandle, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndUnprepareScript(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 25
0
 public override void SetLength(long tempValue)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginSetStreamLength(_streamHandle, tempValue, null, null);
         result.AsyncWaitHandle.WaitOne();
         channel.EndSetStreamLength(result);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 26
0
 public string GetText()
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginGetBatchText(BatchHandle, null, null);
         result.AsyncWaitHandle.WaitOne();
         return(channel.EndGetBatchText(result));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 27
0
 public IRemoteServerExpressionPlan PrepareExpression(string expression, RemoteParam[] paramsValue, DebugLocator locator, out PlanDescriptor planDescriptor, RemoteProcessCleanupInfo cleanupInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginPrepareExpression(ProcessHandle, GetCleanupInfo(cleanupInfo), expression, paramsValue, locator, null, null);
         result.AsyncWaitHandle.WaitOne();
         planDescriptor = channel.EndPrepareExpression(result);
         return(new ClientExpressionPlan(this, planDescriptor));
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 28
0
 public void Execute(string statement, ref RemoteParamData paramsValue, ProcessCallInfo callInfo, RemoteProcessCleanupInfo cleanupInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginExecuteStatement(ProcessHandle, GetCleanupInfo(cleanupInfo), callInfo, statement, paramsValue, null, null);
         result.AsyncWaitHandle.WaitOne();
         ExecuteResult executeResult = channel.EndExecuteStatement(result);
         paramsValue.Data = executeResult.ParamData;
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 29
0
 public static ProcessCleanupInfo GetCleanupInfo(RemoteProcessCleanupInfo cleanupInfo)
 {
     try
     {
         ProcessCleanupInfo localCleanupInfo = new ProcessCleanupInfo();
         localCleanupInfo.UnprepareList = new int[cleanupInfo.UnprepareList.Length];
         for (int index = 0; index < localCleanupInfo.UnprepareList.Length; index++)
         {
             localCleanupInfo.UnprepareList[index] = ((ClientPlan)cleanupInfo.UnprepareList[index]).PlanHandle;
         }
         return(localCleanupInfo);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }
Esempio n. 30
0
 public RemoteFetchData Fetch(RemoteRowHeader header, out Guid[] bookmarks, int count, bool skipCurrent, ProcessCallInfo callInfo)
 {
     try
     {
         var          channel = GetServiceInterface();
         IAsyncResult result  = channel.BeginFetchSpecific(CursorHandle, callInfo, header, count, skipCurrent, null, null);
         result.AsyncWaitHandle.WaitOne();
         FetchResult fetchResult = channel.EndFetchSpecific(result);
         bookmarks = fetchResult.Bookmarks;
         return(fetchResult.FetchData);
     }
     catch (FaultException <DataphorFault> fault)
     {
         throw DataphorFaultUtility.FaultToException(fault.Detail);
     }
     catch (CommunicationException ce)
     {
         ReportCommunicationError();
         throw new ServerException(ServerException.Codes.CommunicationFailure, ErrorSeverity.Environment, ce);
     }
 }