Example #1
0
    /*
     * @param token is the authentication token
     * @returns the DB structure.
     */
    public Dictionary<string, List<string>> GetDBInfo(string token)
    {
      DateTime dateTime;
      DependencyInjection di = DependencyInjection.GetInstance();
      IAuthValidate iAuthValidate = (IAuthValidate)di.CreateObject("validate", new object[]
                                                                    { null,
                                                                      m_AuthSeverUrl
                                                                      });
      if (!iAuthValidate.Validate(token, out dateTime))
      {
        throw new Exception("Not authenticated");
      }
      Request request = new Request();
      request.SetRequestType(RequestType.DB_QUERY);
      request.setTableServerObject(m_ITableServer);
      request.SetRootServerCallback(OperationContext.Current.GetCallbackChannel<IRootServerCallback>());

      m_RequestQueue.enQueueRequest(request);
      return new Dictionary<string, List<string>>(); 
    }
Example #2
0
 /*
  * GetResult(id,startline,numberOfLines) receives a request asking for data
  * in a table stored on the root server. 
  * @param id is the identifier for the table on root server.
  * @param startLine is the first data entry that the client wants.
  * @param numberOfLines is the total number of data entries the client wants.
  * @param token is the authentication token.
  * @returns the result of operation and info related to the result.
  */
 public QueryResult GetResult(string id, int startLine, int numberOfLines, string token)
 {
   QueryResult queryResult;
   DateTime dateTime;
   DependencyInjection di = DependencyInjection.GetInstance();
   IAuthValidate iAuthValidate = (IAuthValidate)di.CreateObject("validate",new object[]
                                                                 { null,
                                                                   m_AuthSeverUrl
                                                                   });
   if (!iAuthValidate.Validate(token, out dateTime))
   {
     queryResult = new QueryResult(-1, "Could not authenticate user.");
     return queryResult;
   }
   Request request = new Request();
   request.SetRequestType(RequestType.GET_RESULT);
   request.setTableServerObject(m_ITableServer);
   Object[] requestData = new Object[3];
   requestData[0] = id;
   requestData[1] = startLine;
   requestData[2] = numberOfLines;
   request.SetMethodParameters(requestData);
   request.SetRootServerCallback(OperationContext.Current.GetCallbackChannel<IRootServerCallback>());
   
   m_RequestQueue.enQueueRequest(request);
   
   queryResult = new QueryResult(Convert.ToInt32(id), "Query result request received.");
   return queryResult;
 }