DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor Class Reference
Inheritance diagram for Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor:
Deveel.Data.Protocol.IMessageProcessor Deveel.Data.Protocol.IMessageProcessor

Public Member Functions

 ServerMessageProcessor (ServerConnector connector)
 
IMessageEnvelope ProcessMessage (IMessageEnvelope envelope)
 
 ServerMessageProcessor (ServerConnector connector)
 
IMessageEnvelope ProcessMessage (IMessageEnvelope envelope)
 

Private Member Functions

IMessageEnvelope CreateErrorResponse (IMessageEnvelope sourceMessage, string message)
 
IMessageEnvelope CreateErrorResponse (IMessageEnvelope sourceMessage, Exception error)
 
IMessageEnvelope CreateErrorResponse (IDictionary< string, object > metadata, Exception error)
 
IMessageEnvelope ProcessAuthenticate (IDictionary< string, object > metadata, AuthenticateRequest request)
 
IMessageEnvelope ProcessConnect (IDictionary< string, object > metadata, ConnectRequest request)
 
IMessageEnvelope ProcessClose (IDictionary< string, object > metadata)
 
IMessageEnvelope ProcessQuery (IDictionary< string, object > metadata, QueryExecuteRequest request)
 
IMessageEnvelope ProcessQueryPart (IDictionary< string, object > metadata, QueryResultPartRequest request)
 
IMessageEnvelope ProcessDisposeResult (IDictionary< string, object > metadata, DisposeResultRequest request)
 
IMessageEnvelope ProcessCreateLargeObject (IDictionary< string, object > metadata, LargeObjectCreateRequest request)
 
IMessageEnvelope ProcessBegin (IDictionary< string, object > metadata)
 
IMessageEnvelope ProcessCommit (IDictionary< string, object > metadata, CommitRequest request)
 
IMessageEnvelope ProcessRollback (IDictionary< string, object > metadata, RollbackRequest request)
 
IMessageEnvelope CreateErrorResponse (IMessageEnvelope sourceMessage, string message)
 
IMessageEnvelope CreateErrorResponse (IMessageEnvelope sourceMessage, Exception error)
 
IMessageEnvelope CreateErrorResponse (IDictionary< string, object > metadata, Exception error)
 
IMessageEnvelope ProcessAuthenticate (IDictionary< string, object > metadata, AuthenticateRequest request)
 
IMessageEnvelope ProcessConnect (IDictionary< string, object > metadata, ConnectRequest request)
 
IMessageEnvelope ProcessClose (IDictionary< string, object > metadata)
 
IMessageEnvelope ProcessQuery (IDictionary< string, object > metadata, QueryExecuteRequest request)
 
IMessageEnvelope ProcessQueryPart (IDictionary< string, object > metadata, QueryResultPartRequest request)
 
IMessageEnvelope ProcessDisposeResult (IDictionary< string, object > metadata, DisposeResultRequest request)
 
IMessageEnvelope ProcessCreateLargeObject (IDictionary< string, object > metadata, LargeObjectCreateRequest request)
 
IMessageEnvelope ProcessBegin (IDictionary< string, object > metadata)
 
IMessageEnvelope ProcessCommit (IDictionary< string, object > metadata, CommitRequest request)
 
IMessageEnvelope ProcessRollback (IDictionary< string, object > metadata, RollbackRequest request)
 

Private Attributes

readonly ServerConnector connector
 

Detailed Description

Definition at line 535 of file ServerConnector.cs.

Constructor & Destructor Documentation

Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ServerMessageProcessor ( ServerConnector  connector)
inline

Definition at line 538 of file ServerConnector.cs.

538  {
539  this.connector = connector;
540  }
Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ServerMessageProcessor ( ServerConnector  connector)
inline

Definition at line 692 of file ServerConnector.old.cs.

692  {
693  this.connector = connector;
694  }

Member Function Documentation

IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.CreateErrorResponse ( IMessageEnvelope  sourceMessage,
string  message 
)
inlineprivate

Definition at line 542 of file ServerConnector.cs.

542  {
543  return CreateErrorResponse(sourceMessage, new ProtocolException(message));
544  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.CreateErrorResponse ( IMessageEnvelope  sourceMessage,
Exception  error 
)
inlineprivate

Definition at line 546 of file ServerConnector.cs.

546  {
547  IDictionary<string, object> metadata = null;
548  if (sourceMessage != null)
549  metadata = sourceMessage.Metadata;
550 
551  return CreateErrorResponse(metadata, error);
552  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.CreateErrorResponse ( IDictionary< string, object >  metadata,
Exception  error 
)
inlineprivate

Definition at line 554 of file ServerConnector.cs.

554  {
555  var envelope = connector.CreateEnvelope(metadata, new AcknowledgeResponse(false));
556  envelope.SetError(error);
557  return envelope;
558  }
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.CreateErrorResponse ( IMessageEnvelope  sourceMessage,
string  message 
)
inlineprivate

Definition at line 696 of file ServerConnector.old.cs.

696  {
697  return CreateErrorResponse(sourceMessage, new ProtocolException(message));
698  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.CreateErrorResponse ( IMessageEnvelope  sourceMessage,
Exception  error 
)
inlineprivate

Definition at line 700 of file ServerConnector.old.cs.

700  {
701  IDictionary<string, object> metadata = null;
702  if (sourceMessage != null)
703  metadata = sourceMessage.Metadata;
704 
705  return CreateErrorResponse(metadata, error);
706  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.CreateErrorResponse ( IDictionary< string, object >  metadata,
Exception  error 
)
inlineprivate

Definition at line 708 of file ServerConnector.old.cs.

708  {
709  var envelope = connector.CreateEnvelope(metadata, new AcknowledgeResponse(false));
710  envelope.SetError(error);
711  return envelope;
712  }
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessAuthenticate ( IDictionary< string, object >  metadata,
AuthenticateRequest  request 
)
inlineprivate

Definition at line 560 of file ServerConnector.cs.

560  {
561  try {
562  if (!connector.Authenticate(request.DefaultSchema, request.UserName, request.Password)) {
563  var response = connector.CreateEnvelope(metadata, new AuthenticateResponse(false, -1));
564  // TODO: make the specialized exception ...
565  response.SetError(new Exception("Unable to authenticate."));
566  return response;
567  }
568 
569  connector.ChangeState(ConnectorState.Authenticated);
570 
571  // TODO: Get the UNIX epoch here?
572  return connector.CreateEnvelope(metadata, new AuthenticateResponse(true, DateTime.UtcNow.Ticks));
573  } catch (Exception ex) {
574  return CreateErrorResponse(metadata, ex);
575  }
576  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
void ChangeState(ConnectorState newState)
virtual bool Authenticate(string defaultSchema, string username, string password)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessAuthenticate ( IDictionary< string, object >  metadata,
AuthenticateRequest  request 
)
inlineprivate

Definition at line 714 of file ServerConnector.old.cs.

714  {
715  try {
716  if (!connector.Authenticate(request.DefaultSchema, request.UserName, request.Password)) {
717  var response = connector.CreateEnvelope(metadata, new AuthenticateResponse(false, -1));
718  // TODO: make the specialized exception ...
719  response.SetError(new Exception("Unable to authenticate."));
720  return response;
721  }
722 
723  connector.ChangeState(ConnectorState.Authenticated);
724 
725  // TODO: Get the UNIX epoch here?
726  return connector.CreateEnvelope(metadata, new AuthenticateResponse(true, DateTime.UtcNow.Ticks));
727  } catch (Exception ex) {
728  return CreateErrorResponse(metadata, ex);
729  }
730  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
void ChangeState(ConnectorState newState)
virtual bool Authenticate(string defaultSchema, string username, string password)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessBegin ( IDictionary< string, object >  metadata)
inlineprivate

Definition at line 709 of file ServerConnector.cs.

709  {
710  try {
713 
714  var id = connector.BeginTransaction();
715  return connector.CreateEnvelope(metadata, new BeginResponse(id));
716  } catch (Exception ex) {
717  // TODO: Log the error ...
718  return CreateErrorResponse(metadata, ex);
719  }
720  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessBegin ( IDictionary< string, object >  metadata)
inlineprivate

Definition at line 871 of file ServerConnector.old.cs.

871  {
872  try {
875 
876  var id = connector.BeginTransaction();
877  return connector.CreateEnvelope(metadata, new BeginResponse(id));
878  } catch (Exception ex) {
879  connector.Logger.Error(connector, "Error while beginning a transaction.");
880  connector.Logger.Error(connector, ex);
881  return CreateErrorResponse(metadata, ex);
882  }
883  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessClose ( IDictionary< string, object >  metadata)
inlineprivate

Definition at line 642 of file ServerConnector.cs.

642  {
643  try {
646 
648  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
649  } catch (Exception ex) {
650  // TODO: Log the error ...
651  return CreateErrorResponse(metadata, ex);
652  }
653  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessClose ( IDictionary< string, object >  metadata)
inlineprivate

Definition at line 798 of file ServerConnector.old.cs.

798  {
799  try {
802 
804  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
805  } catch (Exception ex) {
806  connector.Logger.Error(connector, "Error while closing a connection.");
807  connector.Logger.Error(connector, ex);
808  return CreateErrorResponse(metadata, ex);
809  }
810  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessCommit ( IDictionary< string, object >  metadata,
CommitRequest  request 
)
inlineprivate

Definition at line 722 of file ServerConnector.cs.

722  {
723  try {
726 
727  connector.CommitTransaction(request.TransactionId);
728  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
729  } catch (Exception ex) {
730  // TODO: Log the error ...
731  return CreateErrorResponse(metadata, ex);
732  }
733  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessCommit ( IDictionary< string, object >  metadata,
CommitRequest  request 
)
inlineprivate

Definition at line 885 of file ServerConnector.old.cs.

885  {
886  try {
889 
890  connector.CommitTransaction(request.TransactionId);
891  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
892  } catch (Exception ex) {
893  connector.Logger.Error(connector, "Error while committing the transaction.");
894  connector.Logger.Error(connector, ex);
895  return CreateErrorResponse(metadata, ex);
896  }
897  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessConnect ( IDictionary< string, object >  metadata,
ConnectRequest  request 
)
inlineprivate

Definition at line 613 of file ServerConnector.cs.

613  {
614  Exception error = null;
615  ConnectResponse response;
616 
617  try {
618  connector.OpenConnector(request.RemoteEndPoint, request.DatabaseName);
619  if (request.AutoCommit)
620  connector.SetAutoCommit(request.AutoCommit);
621 
622  connector.SetIgnoreIdentifiersCase(request.IgnoreIdentifiersCase);
623  connector.SetParameterStyle(request.ParameterStyle);
624 
625  var encryptionData = connector.GetEncryptionData();
626 
627  var serverVersion = connector.Database.Version.ToString(2);
628  response = new ConnectResponse(true, serverVersion, encryptionData != null, encryptionData);
629  } catch (Exception ex) {
630  // TODO: Log the error ...
631  error = ex;
632  response = new ConnectResponse(false, null);
633  }
634 
635  var envelope = connector.CreateEnvelope(metadata, response);
636  if (error != null)
637  envelope.SetError(error);
638 
639  return connector.CreateEnvelope(metadata, response);
640  }
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
void OpenConnector(ConnectionEndPoint remoteEndPoint, string databaseName)
void SetParameterStyle(QueryParameterStyle parameterStyle)
Version Version
Gets the version number of this database.
Definition: IDatabase.cs:83
virtual EncryptionData GetEncryptionData()
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessConnect ( IDictionary< string, object >  metadata,
ConnectRequest  request 
)
inlineprivate

Definition at line 767 of file ServerConnector.old.cs.

767  {
768  Exception error = null;
769  ConnectResponse response;
770 
771  try {
772  connector.OpenConnector(request.RemoteEndPoint, request.DatabaseName);
773  if (request.AutoCommit)
774  connector.SetAutoCommit(request.AutoCommit);
775 
776  connector.SetIgnoreIdentifiersCase(request.IgnoreIdentifiersCase);
777  connector.SetParameterStyle(request.ParameterStyle);
778 
779  var encryptionData = connector.GetEncryptionData();
780 
781  var serverVersion = connector.Database.Version.ToString(2);
782  response = new ConnectResponse(true, serverVersion, encryptionData != null, encryptionData);
783  } catch (Exception ex) {
784  connector.Logger.Error(connector, "Error while opening a connection.");
785  connector.Logger.Error(connector, ex);
786 
787  error = ex;
788  response = new ConnectResponse(false, null);
789  }
790 
791  var envelope = connector.CreateEnvelope(metadata, response);
792  if (error != null)
793  envelope.SetError(error);
794 
795  return connector.CreateEnvelope(metadata, response);
796  }
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
void OpenConnector(ConnectionEndPoint remoteEndPoint, string databaseName)
void SetParameterStyle(QueryParameterStyle parameterStyle)
Version Version
Gets the version number of this database.
Definition: IDatabase.cs:83
virtual EncryptionData GetEncryptionData()
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessCreateLargeObject ( IDictionary< string, object >  metadata,
LargeObjectCreateRequest  request 
)
inlineprivate

Definition at line 695 of file ServerConnector.cs.

696  {
697  try {
700 
701  var objRef = connector.CreateLargeObject(request.ObjectLength);
702  return connector.CreateEnvelope(metadata, new LargeObjectCreateResponse(request.ObjectLength, objRef));
703  } catch (Exception ex) {
704  // TODO: Log the error ...
705  return CreateErrorResponse(metadata, ex);
706  }
707  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
ObjectId CreateLargeObject(long objectLength)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessCreateLargeObject ( IDictionary< string, object >  metadata,
LargeObjectCreateRequest  request 
)
inlineprivate

Definition at line 855 of file ServerConnector.old.cs.

856  {
857  try {
860 
861  var objRef = connector.CreateStreamableObject(request.ReferenceType, request.ObjectLength);
862  return connector.CreateEnvelope(metadata,
863  new LargeObjectCreateResponse(request.ReferenceType, request.ObjectLength, objRef));
864  } catch (Exception ex) {
865  connector.Logger.Error(connector, "Error while creating a large object.");
866  connector.Logger.Error(connector, ex);
867  return CreateErrorResponse(metadata, ex);
868  }
869  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
long CreateStreamableObject(ReferenceType referenceType, long length)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessDisposeResult ( IDictionary< string, object >  metadata,
DisposeResultRequest  request 
)
inlineprivate

Definition at line 682 of file ServerConnector.cs.

682  {
683  try {
686 
687  connector.DisposeResult(request.ResultId);
688  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
689  } catch (Exception ex) {
690  // TODO: Log the error ...
691  return CreateErrorResponse(metadata, ex);
692  }
693  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessDisposeResult ( IDictionary< string, object >  metadata,
DisposeResultRequest  request 
)
inlineprivate

Definition at line 841 of file ServerConnector.old.cs.

841  {
842  try {
845 
846  connector.DisposeResult(request.ResultId);
847  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
848  } catch (Exception ex) {
849  connector.Logger.Error(connector, "Error occurred while disposing a query result.");
850  connector.Logger.Error(connector, ex);
851  return CreateErrorResponse(metadata, ex);
852  }
853  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessMessage ( IMessageEnvelope  envelope)
inline

Implements Deveel.Data.Protocol.IMessageProcessor.

Definition at line 578 of file ServerConnector.cs.

578  {
579  var metadata = envelope.Metadata;
580  var message = connector.GetMessage(envelope);
581  if (message == null)
582  return CreateErrorResponse(metadata, new Exception("No message found in the envelope."));
583 
584  if (message is ConnectRequest)
585  return ProcessConnect(metadata, (ConnectRequest)message);
586 
587  if (message is AuthenticateRequest)
588  return ProcessAuthenticate(metadata, (AuthenticateRequest)message);
589 
590  if (message is QueryExecuteRequest)
591  return ProcessQuery(metadata, (QueryExecuteRequest)message);
592  if (message is QueryResultPartRequest)
593  return ProcessQueryPart(metadata, (QueryResultPartRequest)message);
594  if (message is DisposeResultRequest)
595  return ProcessDisposeResult(metadata, (DisposeResultRequest)message);
596 
597  if (message is LargeObjectCreateRequest)
598  return ProcessCreateLargeObject(metadata, (LargeObjectCreateRequest)message);
599 
600  if (message is BeginRequest)
601  return ProcessBegin(metadata);
602  if (message is CommitRequest)
603  return ProcessCommit(metadata, (CommitRequest)message);
604  if (message is RollbackRequest)
605  return ProcessRollback(metadata, (RollbackRequest)message);
606 
607  if (message is CloseRequest)
608  return ProcessClose(metadata);
609 
610  return CreateErrorResponse(envelope, "Message not supported");
611  }
IMessageEnvelope ProcessQueryPart(IDictionary< string, object > metadata, QueryResultPartRequest request)
IMessageEnvelope ProcessCommit(IDictionary< string, object > metadata, CommitRequest request)
IMessageEnvelope ProcessAuthenticate(IDictionary< string, object > metadata, AuthenticateRequest request)
IMessageEnvelope ProcessBegin(IDictionary< string, object > metadata)
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
IMessageEnvelope ProcessCreateLargeObject(IDictionary< string, object > metadata, LargeObjectCreateRequest request)
IMessageEnvelope ProcessRollback(IDictionary< string, object > metadata, RollbackRequest request)
IMessageEnvelope ProcessConnect(IDictionary< string, object > metadata, ConnectRequest request)
IMessageEnvelope ProcessDisposeResult(IDictionary< string, object > metadata, DisposeResultRequest request)
IMessageEnvelope ProcessQuery(IDictionary< string, object > metadata, QueryExecuteRequest request)
virtual IMessage GetMessage(IMessageEnvelope envelope)
IMessageEnvelope ProcessClose(IDictionary< string, object > metadata)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessMessage ( IMessageEnvelope  envelope)
inline

Implements Deveel.Data.Protocol.IMessageProcessor.

Definition at line 732 of file ServerConnector.old.cs.

732  {
733  var metadata = envelope.Metadata;
734  var message = connector.GetMessage(envelope);
735  if (message == null)
736  return CreateErrorResponse(metadata, new Exception("No message found in the envelope."));
737 
738  if (message is ConnectRequest)
739  return ProcessConnect(metadata, (ConnectRequest) message);
740 
741  if (message is AuthenticateRequest)
742  return ProcessAuthenticate(metadata, (AuthenticateRequest) message);
743 
744  if (message is QueryExecuteRequest)
745  return ProcessQuery(metadata, (QueryExecuteRequest) message);
746  if (message is QueryResultPartRequest)
747  return ProcessQueryPart(metadata, (QueryResultPartRequest) message);
748  if (message is DisposeResultRequest)
749  return ProcessDisposeResult(metadata, (DisposeResultRequest) message);
750 
751  if (message is LargeObjectCreateRequest)
752  return ProcessCreateLargeObject(metadata, (LargeObjectCreateRequest) message);
753 
754  if (message is BeginRequest)
755  return ProcessBegin(metadata);
756  if (message is CommitRequest)
757  return ProcessCommit(metadata, (CommitRequest)message);
758  if (message is RollbackRequest)
759  return ProcessRollback(metadata, (RollbackRequest)message);
760 
761  if (message is CloseRequest)
762  return ProcessClose(metadata);
763 
764  return CreateErrorResponse(envelope, "Message not supported");
765  }
IMessageEnvelope ProcessQueryPart(IDictionary< string, object > metadata, QueryResultPartRequest request)
IMessageEnvelope ProcessCommit(IDictionary< string, object > metadata, CommitRequest request)
IMessageEnvelope ProcessAuthenticate(IDictionary< string, object > metadata, AuthenticateRequest request)
IMessageEnvelope ProcessBegin(IDictionary< string, object > metadata)
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
IMessageEnvelope ProcessCreateLargeObject(IDictionary< string, object > metadata, LargeObjectCreateRequest request)
IMessageEnvelope ProcessRollback(IDictionary< string, object > metadata, RollbackRequest request)
IMessageEnvelope ProcessConnect(IDictionary< string, object > metadata, ConnectRequest request)
IMessageEnvelope ProcessDisposeResult(IDictionary< string, object > metadata, DisposeResultRequest request)
IMessageEnvelope ProcessQuery(IDictionary< string, object > metadata, QueryExecuteRequest request)
virtual IMessage GetMessage(IMessageEnvelope envelope)
IMessageEnvelope ProcessClose(IDictionary< string, object > metadata)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessQuery ( IDictionary< string, object >  metadata,
QueryExecuteRequest  request 
)
inlineprivate

Definition at line 655 of file ServerConnector.cs.

655  {
656  try {
659 
660  // TODO: use the timeout ...
661  var queryResonse = connector.ExecuteQuery(request.CommitId, request.Query.Text, request.Query.Parameters);
662  return connector.CreateEnvelope(metadata, new QueryExecuteResponse(queryResonse));
663  } catch (Exception ex) {
664  // TODO: Log the error ...
665  return CreateErrorResponse(metadata, ex);
666  }
667  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IQueryResponse[] ExecuteQuery(long commitId, string text, IEnumerable< QueryParameter > parameters)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessQuery ( IDictionary< string, object >  metadata,
QueryExecuteRequest  request 
)
inlineprivate

Definition at line 812 of file ServerConnector.old.cs.

812  {
813  try {
816 
817  // TODO: use the timeout ...
818  var queryResonse = connector.ExecuteQuery(request.Query.Text, request.Query.Parameters);
819  return connector.CreateEnvelope(metadata, new QueryExecuteResponse(queryResonse));
820  } catch (Exception ex) {
821  connector.Logger.Error(connector, "Error while processing a query request.");
822  connector.Logger.Error(connector, ex);
823  return CreateErrorResponse(metadata, ex);
824  }
825  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IQueryResponse[] ExecuteQuery(long commitId, string text, IEnumerable< QueryParameter > parameters)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessQueryPart ( IDictionary< string, object >  metadata,
QueryResultPartRequest  request 
)
inlineprivate

Definition at line 669 of file ServerConnector.cs.

669  {
670  try {
673 
674  var part = connector.GetResultPart(request.ResultId, request.RowIndex, request.Count);
675  return connector.CreateEnvelope(metadata, new QueryResultPartResponse(request.ResultId, part));
676  } catch (Exception ex) {
677  // TODO: Log the error ...
678  return CreateErrorResponse(metadata, ex);
679  }
680  }
QueryResultPart GetResultPart(int resultId, int startRow, int countRows)
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessQueryPart ( IDictionary< string, object >  metadata,
QueryResultPartRequest  request 
)
inlineprivate

Definition at line 827 of file ServerConnector.old.cs.

827  {
828  try {
831 
832  var part = connector.GetResultPart(request.ResultId, request.RowIndex, request.Count);
833  return connector.CreateEnvelope(metadata, new QueryResultPartResponse(request.ResultId, part));
834  } catch (Exception ex) {
835  connector.Logger.Error(connector, "Error while requesting part of a query result.");
836  connector.Logger.Error(connector, ex);
837  throw;
838  }
839  }
QueryResultPart GetResultPart(int resultId, int startRow, int countRows)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessRollback ( IDictionary< string, object >  metadata,
RollbackRequest  request 
)
inlineprivate

Definition at line 735 of file ServerConnector.cs.

735  {
736  try {
739 
740  connector.RollbackTransaction(request.TransactionId);
741  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
742  } catch (Exception ex) {
743  // TODO: Log the error ...
744  return CreateErrorResponse(metadata, ex);
745  }
746  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)
IMessageEnvelope Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.ProcessRollback ( IDictionary< string, object >  metadata,
RollbackRequest  request 
)
inlineprivate

Definition at line 899 of file ServerConnector.old.cs.

899  {
900  try {
903 
904  connector.RollbackTransaction(request.TransactionId);
905  return connector.CreateEnvelope(metadata, new AcknowledgeResponse(true));
906  } catch (Exception ex) {
907  connector.Logger.Error(connector, "Error while rolling-back the transaction.");
908  connector.Logger.Error(connector, ex);
909  return CreateErrorResponse(metadata, ex);
910  }
911  }
IMessageEnvelope CreateErrorResponse(IMessageEnvelope sourceMessage, string message)
abstract IServerMessageEnvelope CreateEnvelope(IDictionary< string, object > metadata, IMessage message)

Member Data Documentation

readonly ServerConnector Deveel.Data.Protocol.ServerConnector.ServerMessageProcessor.connector
private

Definition at line 536 of file ServerConnector.cs.


The documentation for this class was generated from the following files: