Example #1
0
        /**
         *  Returns an integer value by the index
         *  @param index  the index of the value
         *  @return the value as integer
         */
        public long?getInt(int index)
        {
            TJSONValue p = get(index);

            if (p == null)
            {
                return(null);
            }
            long?d = ((TJSONNumber)p).getValueInt();

            if (d.HasValue)
            {
                return(d.Value);
            }
            return(null);
        }
Example #2
0
        /**
         *  Returns a double value by the index
         *  @param index  the index of the value
         *  @return the value as double
         */
        public Double?getDouble(int index)
        {
            TJSONValue p = get(index);

            if (p == null)
            {
                return(null);
            }
            Double?d = ((TJSONNumber)p).getValue();

            if (d.HasValue)
            {
                return(d.Value);
            }
            return(null);
        }
Example #3
0
        /**
         *  Returns a boolean value by the index
         *  @param index  the index of the value
         *  @return the value as boolean
         */
        public Boolean?getBoolean(int index)
        {
            TJSONValue p = get(index);

            if (p == null)
            {
                return(null);
            }
            if (p is TJSONTrue)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
 public virtual void SetAsJSONValue(TJSONValue Value)
 {
     throw new DBXException("Invalid Type Access");
 }
 /**
  * Set as JsonValueType
  */
 public override void SetAsJSONValue(TJSONValue Value)
 {
     jsonValueValue = Value;
     setDBXType(DBXDataTypes.JsonValueType);
 }
Example #6
0
 public void NotifyCallback(String ClientId, String CallbackId, TJSONValue Msg, NotifyCallbackCallback callback = null, ExceptionCallback ExCal = null)
 {
     DSRESTCommand cmd = getConnection().CreateCommand();
     cmd.setRequestType(DSHTTPRequestType.POST);
     cmd.setText("DSAdmin.NotifyCallback");
     cmd.prepare(get_DSAdmin_NotifyCallback_Metadata());
     NotifyCallbackDelegate NotifyCallbackDel = () => {
       if (callback != null)
       {
     NotifyCallbackReturns ret = new NotifyCallbackReturns();
     ret.Response = (TJSONValue)cmd.getParameter(3).getValue().GetAsJSONValue();
     ret.returnValue = cmd.getParameter(4).getValue().GetAsBoolean();
     callback.DynamicInvoke(ret);
       }
     };
     cmd.getParameter(0).getValue().SetAsString(ClientId);
     cmd.getParameter(1).getValue().SetAsString(CallbackId);
     cmd.getParameter(2).getValue().SetAsJSONValue(Msg);
     getConnection().execute(cmd, this, NotifyCallbackDel, ExCal);
 }
Example #7
0
 public void ConsumeClientChannelTimeout(String ChannelName, String ClientManagerId, String CallbackId, String ChannelNames, String SecurityToken, int Timeout, TJSONValue ResponseData, ConsumeClientChannelTimeoutCallback callback = null, ExceptionCallback ExCal = null)
 {
     DSRESTCommand cmd = getConnection().CreateCommand();
     cmd.setRequestType(DSHTTPRequestType.POST);
     cmd.setText("DSAdmin.ConsumeClientChannelTimeout");
     cmd.prepare(get_DSAdmin_ConsumeClientChannelTimeout_Metadata());
     ConsumeClientChannelTimeoutDelegate ConsumeClientChannelTimeoutDel = () => {
       if (callback != null)
       {
     callback.DynamicInvoke((TJSONValue)cmd.getParameter(7).getValue().GetAsJSONValue());
       }
     };
     cmd.getParameter(0).getValue().SetAsString(ChannelName);
     cmd.getParameter(1).getValue().SetAsString(ClientManagerId);
     cmd.getParameter(2).getValue().SetAsString(CallbackId);
     cmd.getParameter(3).getValue().SetAsString(ChannelNames);
     cmd.getParameter(4).getValue().SetAsString(SecurityToken);
     cmd.getParameter(5).getValue().SetAsInt32(Timeout);
     cmd.getParameter(6).getValue().SetAsJSONValue(ResponseData);
     getConnection().execute(cmd, this, ConsumeClientChannelTimeoutDel, ExCal);
 }
Example #8
0
 public virtual void SetAsJSONValue(TJSONValue Value)
 {
     throw new DBXException("Invalid Type Access");
 }
Example #9
0
 public void NotifyCallback(String ClientId, String CallbackId, TJSONValue Msg, DSAdmin.NotifyCallbackCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.NotifyCallback(ClientId, CallbackId, Msg, callback, ExCal);
 }
 /**
 * Set as JsonValueType
 */
 public override void SetAsJSONValue(TJSONValue Value)
 {
     jsonValueValue = Value;
     setDBXType(DBXDataTypes.JsonValueType);
 }
Example #11
0
 /**
  * Adds a TJSonValue
  * @param value a TJSONValue
  * @returns a itlsef
  */
 public TJSONArray add(TJSONValue value)
 {
     Elements.Add(value);
     return(this);
 }
Example #12
0
 /**
  * Adds a pair with name and a {@link TJSONValue}
  * @param String name
  * @param TJSONValue value
  * @return TJSONObject
  */
 public TJSONObject addPairs(String name, TJSONValue value)
 {
     return addPairs(new TJSONPair(name, value));
 }
Example #13
0
 /**
  * Initializes the TJSONPair with a String with the specified name.
  * @param String name
  * @param String value
  */
 public TJSONPair(String name, String value)
 {
     this.name = name;
     this.value = new TJSONString(value);
 }
Example #14
0
 /**
  * Class constructor, initializes the TJSONPair with a TJSONValue with the
  * specified name.
  * @param String name
  * @param TJSONValue value
  */
 public TJSONPair(String name, TJSONValue value)
 {
     this.name = name;
     this.value = value;
 }
Example #15
0
 /**
  * Class constructor, initializes the TJSONPair with a TJSONValue with the
  * specified name.
  * @param String name
  * @param TJSONValue value
  */
 public TJSONPair(String name, TJSONValue value)
 {
     this.name  = name;
     this.value = value;
 }
 public void BroadcastToChannel(String ChannelName, TJSONValue Msg, DSAdmin.BroadcastToChannelCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.BroadcastToChannel(ChannelName, Msg, callback, ExCal);
 }
Example #17
0
 /**
  * Adds a TJSonValue
  * @param value a TJSONValue
  * @returns a itlsef
  */
 public TJSONArray add(TJSONValue value)
 {
     Elements.Add(value);
     return this;
 }
 public void NotifyCallback(String ClientId, String CallbackId, TJSONValue Msg, DSAdmin.NotifyCallbackCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.NotifyCallback(ClientId, CallbackId, Msg, callback, ExCal);
 }
Example #19
0
            /**
             * @return JObject
             */
            private TJSONValue channelCallbackExecute()
            {
                Object     o     = new Object();
                TJSONValue Value = new TJSONTrue();
                TJSONValue res   = null;
                long       lastRequestAttempt = 0;
                int        retries            = 0;

                while (!stopped)
                {
                    lastRequestAttempt = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                    res = null;
                    Exception raisedException = null;
                    Monitor.Enter(o);
                    try
                    {
                        dsadmin.ConsumeClientChannel(mngr.getChannelName(), mngr
                                                     .getManagerID(), "", mngr.getChannelName(), mngr
                                                     .getSecurityToken(), Value,
                                                     (r) =>
                        {
                            Monitor.Enter(o);
                            try
                            {
                                res = r;
                                Monitor.PulseAll(o);
                            }
                            finally
                            {
                                Monitor.Exit(o);
                            }
                        }, (e) =>
                        {
                            Monitor.Enter(o);
                            try
                            {
                                raisedException = e;
                                Monitor.PulseAll(o);
                            }
                            finally
                            {
                                Monitor.Exit(o);
                            }
                        }
                                                     );
                        Monitor.Wait(o);

                        //analize the callback's results
                        if (raisedException != null)
                        {
                            if ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - lastRequestAttempt >= dsadmin.getConnection().getConnectionTimeout() + 1000)
                            {
                                retries = 0;
                            }
                            if (retries == this.mngr.getMaxRetries())
                            {
                                terminate();
                                res = null;
                                mngr.Connection.syncContext.Send(new SendOrPostCallback(x => mngr.ExCallback.DynamicInvoke(raisedException)), null);
                            }
                            retries++;
                            Thread.Sleep(this.mngr.getRetryDelay());
                        }
                        else
                        {
                            break;
                        }
                    }
                    finally {
                        Monitor.Exit(o);
                    }
                } //while
                return(res);
            }
Example #20
0
 public void BroadcastToChannel(String ChannelName, TJSONValue Msg, BroadcastToChannelCallback callback = null, ExceptionCallback ExCal = null)
 {
     DSRESTCommand cmd = getConnection().CreateCommand();
     cmd.setRequestType(DSHTTPRequestType.POST);
     cmd.setText("DSAdmin.BroadcastToChannel");
     cmd.prepare(get_DSAdmin_BroadcastToChannel_Metadata());
     BroadcastToChannelDelegate BroadcastToChannelDel = () => {
       if (callback != null)
       {
     callback.DynamicInvoke(cmd.getParameter(2).getValue().GetAsBoolean());
       }
     };
     cmd.getParameter(0).getValue().SetAsString(ChannelName);
     cmd.getParameter(1).getValue().SetAsJSONValue(Msg);
     getConnection().execute(cmd, this, BroadcastToChannelDel, ExCal);
 }
Example #21
0
 public void BroadcastToChannel(String ChannelName, TJSONValue Msg, DSAdmin.BroadcastToChannelCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.BroadcastToChannel(ChannelName, Msg, callback, ExCal);
 }
Example #22
0
 /**
  * Adds a pair with name and a {@link TJSONValue}
  * @param String name
  * @param TJSONValue value
  * @return TJSONObject
  */
 public TJSONObject addPairs(String name, TJSONValue value)
 {
     return(addPairs(new TJSONPair(name, value)));
 }