Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
0
 public virtual void SetAsJSONValue(TJSONValue Value)
 {
     throw new DBXException("Invalid Type Access");
 }
Ejemplo n.º 5
0
 /**
  * Set as JsonValueType
  */
 public override void SetAsJSONValue(TJSONValue Value)
 {
     jsonValueValue = Value;
     setDBXType(DBXDataTypes.JsonValueType);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 8
0
 public virtual void SetAsJSONValue(TJSONValue Value)
 {
     throw new DBXException("Invalid Type Access");
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 10
0
 /**
 * Set as JsonValueType
 */
 public override void SetAsJSONValue(TJSONValue Value)
 {
     jsonValueValue = Value;
     setDBXType(DBXDataTypes.JsonValueType);
 }
Ejemplo n.º 11
0
 /**
  * Adds a TJSonValue
  * @param value a TJSONValue
  * @returns a itlsef
  */
 public TJSONArray add(TJSONValue value)
 {
     Elements.Add(value);
     return(this);
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
 }
Ejemplo n.º 21
0
 public void BroadcastToChannel(String ChannelName, TJSONValue Msg, DSAdmin.BroadcastToChannelCallback callback = null, DSAdmin.ExceptionCallback ExCal = null)
 {
     dsadmin.BroadcastToChannel(ChannelName, Msg, callback, ExCal);
 }
Ejemplo n.º 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)));
 }