/** * 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); }
/** * 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); }
/** * 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); } }
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); }
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); }
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); }
public virtual void SetAsJSONValue(TJSONValue Value) { throw new DBXException("Invalid Type Access"); }
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); }
/** * Adds a TJSonValue * @param value a TJSONValue * @returns a itlsef */ public TJSONArray add(TJSONValue value) { Elements.Add(value); return(this); }
/** * 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)); }
/** * 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); }
/** * 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; }
/** * 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); }
/** * 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); }
/** * @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); }
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); }
public void BroadcastToChannel(String ChannelName, TJSONValue Msg, DSAdmin.BroadcastToChannelCallback callback = null, DSAdmin.ExceptionCallback ExCal = null) { dsadmin.BroadcastToChannel(ChannelName, Msg, callback, ExCal); }
/** * 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))); }