Beispiel #1
0
        private void GetResponseCallback(IAsyncResult asyncResult)
        {
            HttpWebResponse response = null;

            try
            {
                response = m_webRequest.EndGetResponse(asyncResult) as HttpWebResponse;
            }
            catch (WebException e)
            {
                LOG.ERROR("EndGetResponse", e);
                response = (HttpWebResponse)e.Response;
                m_code   = Convert.ToInt32(response.StatusCode);
            }

            Stream stream = response.GetResponseStream();

            LOG.INFO("openInputStream done");

            CookieContainer container = new CookieContainer();

            container.Add(new Uri(m_strUrl), response.Cookies);
            m_strCookies = container.GetCookieHeader(new Uri(m_strUrl));

            m_code = Convert.ToInt32(response.StatusCode);
            LOG.INFO("getResponseCode : " + m_code);

            readHeaders(m_headers);
            copyHashtable(m_OutHeaders, m_headers);

            try
            {
                if (m_code >= 400)
                {
                    LOG.ERROR("Error retrieving data: " + m_code);
                    if (m_code == Convert.ToInt32(HttpStatusCode.Unauthorized) && m_oSession != null)
                    {
                        LOG.ERROR("Unauthorize error.Client will be logged out");
                        m_oSession.logout();
                    }

                    m_strRespBody = readFully(stream, getResponseEncoding());
                    LOG.TRACE("Response body: " + m_strRespBody);
                }
                else
                {
                    long len = response.ContentLength;
                    LOG.INFO("fetchRemoteData data size:" + len);

                    m_strRespBody = readFully(stream, getResponseEncoding());
                    LOG.INFO("fetchRemoteData data readFully.");
                }
            }
            finally
            {
                stream.Close();
                response.Close();
                m_respWaitEvent.Set();
            }
        }
Beispiel #2
0
        public override void run()
        {
            LOG.INFO("ClientRegister start");
            while (!isStopping())
            {
                try
                {
                    if (SyncThread.getInstance() != null)
                    {
                        if (doRegister(SyncThread.getSyncEngine()))
                        {
                            m_nPollInterval = POLL_INTERVAL_INFINITE;
                            //break;
                        }
                    }
                }catch (Exception exc)
                {
                    LOG.ERROR("doRegister failed", exc);
                }

                LOG.INFO("Waiting for " + m_nPollInterval + " sec to try again to register client");
                wait(m_nPollInterval);
            }
            LOG.INFO("ClientRegister thread shutdown");
        }
Beispiel #3
0
        public static void Create(RubyModule /*!*/ self, int barType, Object args)
        {
            try
            {
                if (args != null)
                {
                    RhodesApp.createToolBar(barType, (Object)args);
                }

                if (barType == 2)
                {
                    RhodesApp.removeToolBar();
                }
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("create", ex);
                throw rubyEx;
            }
        }
Beispiel #4
0
        public override int getLastPollInterval()
        {
            try{
                long nowTime           = (TimeInterval.getCurrentTime().toULong()) / 1000;
                long latestTimeUpdated = 0;

                Vector <String> arPartNames = DBAdapter.getDBAllPartitionNames();
                for (int i = 0; i < (int)arPartNames.size(); i++)
                {
                    DBAdapter dbPart = DBAdapter.getDB((String)arPartNames.elementAt(i));
                    IDBResult res    = dbPart.executeSQL("SELECT last_updated from sources");
                    for ( ; !res.isEnd(); res.next())
                    {
                        long timeUpdated = res.getLongByIdx(0);
                        if (latestTimeUpdated < timeUpdated)
                        {
                            latestTimeUpdated = timeUpdated;
                        }
                    }
                }

                return(latestTimeUpdated > 0 ? (int)(nowTime - latestTimeUpdated) : 0);
            }catch (Exception exc)
            {
                LOG.ERROR("isStartSyncNow failed.", exc);
            }
            return(0);
        }
Beispiel #5
0
 public static void Navigate(RubyModule /*!*/ self, [NotNull] String /*!*/ url, int index = 0)
 {
     try
     {
         RHODESAPP().processWebNavigate(url, index);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("navigate", ex);
         throw rubyEx;
     }
 }
Beispiel #6
0
        private void createSchema(String strSqlScript)
        {
            if (strSqlScript.length() == 0)
            {
                LOG.ERROR("createSchema failed. Cannot read schema: " + strSqlScript);
                return;
            }

            executeBatchSQL(strSqlScript);
            createTriggers();
        }
Beispiel #7
0
            void processResponse(NetResponse resp)
            {
                if (resp.isOK() && m_mapHeaders != null)
                {
                    String strContType = null;
                    m_mapHeaders.TryGetValue("content-type", out strContType);
                    if (strContType != null && strContType.indexOf("application/json") >= 0)
                    {
                        try{
                            m_valBody = fastJSON.RJSONTokener.JsonDecode(resp.getCharData());
                            return;
                        }catch (Exception exc)
                        {
                            LOG.ERROR("Incorrect json body.", exc);
                        }
                    }
                }

                m_valBody = CRhoRuby.create_string(resp.getCharData());
            }
Beispiel #8
0
 public static void Cancel(RubyModule /*!*/ self, [NotNull] String cancelCallback)
 {
     try
     {
         if (CAsyncHttp.getInstance() != null)
         {
             CAsyncHttp.getInstance().cancelRequest(cancelCallback);
         }
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("cancel", ex);
         throw rubyEx;
     }
 }
Beispiel #9
0
            public static object parse(RubyModule /*!*/ self, [NotNull] string /*!*/ strData)
            {
                object res = null;

                try
                {
                    res = fastJSON.RJSONTokener.JsonDecode(strData);
                }
                catch (Exception ex)
                {
                    Exception rubyEx = self.Context.CurrentException;
                    if (rubyEx == null)
                    {
                        rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                    }
                    LOG.ERROR("parse", ex);
                    throw rubyEx;
                }

                return(res);
            }
Beispiel #10
0
 public static void takePicture(RubyModule /*!*/ self, [NotNull] String /*!*/ callback)
 {
     try
     {
         m_callback = callback;
         CameraCaptureTask cameraCaptureTask;
         cameraCaptureTask            = new CameraCaptureTask();
         cameraCaptureTask.Completed += new EventHandler <PhotoResult>(cameraTask_Completed);
         cameraCaptureTask.Show();
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("take_picture", ex);
         throw rubyEx;
     }
 }
Beispiel #11
0
        public static void choose(RubyModule /*!*/ self, params object[] args)
        {
            try
            {
                if (args != null && args.Length != 4 && args.Length != 5)
                {
                    throw RubyExceptionData.InitializeException(new RuntimeError("wrong number of arguments"), "wrong number of arguments");
                }

                if (args.Length == 5)
                {
                    m_opaque = args[4].ToString();
                }

                m_fmt = int.Parse(args[3].ToString());

                m_callback = args[0].ToString();
                m_title    = args[1].ToString();
                //long init = args[2].toRubyTime().getTime();

                RHODESAPP().MainPage.Dispatcher.BeginInvoke(() =>
                {
                    OpenPickerPage();
                });
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("choose", ex);
                throw rubyEx;
            }
        }
Beispiel #12
0
        public static object login(RubyModule /*!*/ self, [NotNull] String /*!*/ name, [NotNull] String /*!*/ pwd, [NotNull] String /*!*/ callback)
        {
            try{
                SyncThread.stopSync();

                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncLoginCommand(name, pwd, callback,
                                                                                         new SyncNotify.SyncNotification(callback, "", false)));
                return(SyncThread.getInstance().getRetValue());
            }
            catch (Exception e)
            {
                LOG.ERROR("SyncEngine.login", e);
                RhoRuby.raise_RhoError(RhoAppAdapter.ERR_RUNTIME);
            }

            return(null);
        }
Beispiel #13
0
        public static void set_property_by_name(RubyModule /*!*/ self, [NotNull] String /*!*/ name, Object value)
        {
            try
            {
                RhoConf.getInstance().setString(name, value as String, true);

                RhoLogger.getLogConf().loadFromConf(RhoConf.getInstance());
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("set_property_by_name", ex);
                throw rubyEx;
            }
        }
Beispiel #14
0
            public override void Write(byte[] /*!*/ buffer, int offset, int count)
            {
                if (count == 0)
                {
                    return;
                }

                if (count == 1 && buffer[0] == 10 || buffer[0] == 13)
                {
                    return;
                }

                String str = System.Text.Encoding.UTF8.GetString(buffer, offset, count);

                if (m_bError)
                {
                    LOG.ERROR(str);
                }
                else
                {
                    LOG.INFO(str);
                }
            }
Beispiel #15
0
        public void doSyncAllSources(String strQueryParams)
        {
            try
            {
                prepareSync(esSyncAllSources, null);

                if (isContinueSync())
                {
                    PROF.CREATE_COUNTER("Net");
                    PROF.CREATE_COUNTER("Parse");
                    PROF.CREATE_COUNTER("DB");
                    PROF.CREATE_COUNTER("Data");
                    PROF.CREATE_COUNTER("Data1");
                    PROF.CREATE_COUNTER("Pull");
                    PROF.START("Sync");

                    syncAllSources(strQueryParams);

                    PROF.DESTROY_COUNTER("Net");
                    PROF.DESTROY_COUNTER("Parse");
                    PROF.DESTROY_COUNTER("DB");
                    PROF.DESTROY_COUNTER("Data");
                    PROF.DESTROY_COUNTER("Data1");
                    PROF.DESTROY_COUNTER("Pull");
                    PROF.STOP("Sync");
                }

                getNotify().cleanCreateObjectErrors();
            }catch (Exception exc)
            {
                LOG.ERROR("Sync failed.", exc);
            }

            if (getState() != esExit)
            {
                setState(esNone);
            }
        }
Beispiel #16
0
        private void WebBrowser_OnScriptNotify(object sender, NotifyEventArgs e)
        {
            string request = e.Value;

            if (request.startsWith(JS_NOTIFY_CONSOLE_LOG))
            {
                JSLOG.INFO(request.substring(JS_NOTIFY_CONSOLE_LOG.length()).trim());
            }
            else if (request.startsWith(JS_NOTIFY_CONSOLE_INFO))
            {
                JSLOG.INFO(request.substring(JS_NOTIFY_CONSOLE_INFO.length()).trim());
            }
            else if (request.startsWith(JS_NOTIFY_CONSOLE_WARNING))
            {
                JSLOG.WARNING(request.substring(JS_NOTIFY_CONSOLE_WARNING.length()).trim());
            }
            else if (request.startsWith(JS_NOTIFY_CONSOLE_ERROR))
            {
                JSLOG.ERROR(request.substring(JS_NOTIFY_CONSOLE_ERROR.length()).trim());
            }
            else if (request.startsWith(JS_NOTIFY_REQUEST))
            {
                string req = request.substring(JS_NOTIFY_REQUEST.length()).trim();

                IDictionary res = null;
                try
                {
                    res = (IDictionary)fastJSON.RJSONTokener.JsonDecode(req);
                }
                catch (Exception ex)
                {
                    LOG.ERROR("JsonDecode", ex);
                    throw ex;
                }

                if (null != res)
                {
                    string      url         = res["url"].ToString();
                    string      type        = res["type"].ToString().toUpperCase();
                    string      contentType = res["contentType"].ToString();
                    IDictionary headers     = (IDictionary)res["headers"];
                    headers["X-Requested-With"] = "XMLHttpRequest";
                    IDictionary data = (IDictionary)res["data"];

                    string httpUsername = (null == res["usename"]) ? null : res["usename"].ToString();
                    string httpPassword = (null == res["password"]) ? null : res["password"].ToString();
                    string ajaxContext  = data[AJAX_CONTEXT_PARAM].ToString();

                    int tabIdx = RHODESAPP().getTabIndexFor(sender);

                    if (!RHODESAPP().HttpServer.processBrowserRequest(
                            type,
                            new Uri(pathFromUrl(url), UriKind.Relative),
                            headers,
                            data,
                            ajaxContext,
                            tabIdx
                            ))
                    {
                        LOG.ERROR("External requests should be filtered in javascript");
                    }
                }
                else
                {
                    LOG.ERROR("Empty request URI");
                }
            }
        }
Beispiel #17
0
        public void processServerResponse_ver3(JSONArrayIterator oJsonArr)
        {
            PROF.START("Data1");

            int nVersion = 0;

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("version"))
            {
                nVersion = oJsonArr.getCurItem().getInt("version");
                oJsonArr.next();
            }

            if (nVersion != getProtocol().getVersion())
            {
                LOG.ERROR("Sync server send data with incompatible version. Client version: " + getProtocol().getVersion() +
                          "; Server response version: " + nVersion + ". Source name: " + getName());
                getSync().stopSync();
                m_nErrCode = RhoAppAdapter.ERR_UNEXPECTEDSERVERRESPONSE;
                return;
            }

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("token"))
            {
                processToken(oJsonArr.getCurItem().getUInt64("token"));
                oJsonArr.next();
            }

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("source"))
            {
                //skip it. it uses in search only
                oJsonArr.next();
            }

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("count"))
            {
                setCurPageCount(oJsonArr.getCurItem().getInt("count"));
                oJsonArr.next();
            }

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("refresh_time"))
            {
                setRefreshTime(oJsonArr.getCurItem().getInt("refresh_time"));
                oJsonArr.next();
            }

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("progress_count"))
            {
                //TODO: progress_count
                //setTotalCount(oJsonArr.getCurItem().getInt("progress_count"));
                oJsonArr.next();
            }

            if (!oJsonArr.isEnd() && oJsonArr.getCurItem().hasName("total_count"))
            {
                setTotalCount(oJsonArr.getCurItem().getInt("total_count"));
                oJsonArr.next();
            }

            //if ( getServerObjectsCount() == 0 )
            //    getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");

            if (getToken() == 0)
            {
                //oo conflicts
                getDB().executeSQL("DELETE FROM changed_values where source_id=? and sent>=3", getID());
                //
            }

            LOG.INFO("Got " + getCurPageCount() + "(Processed: " + getServerObjectsCount() + ") records of " + getTotalCount() + " from server. Source: " + getName()
                     + ". Version: " + nVersion);

            PROF.STOP("Data1");
            if (!oJsonArr.isEnd() && getSync().isContinueSync())
            {
                JSONEntry oCmds = oJsonArr.getCurItem();
                PROF.START("Data");

                if (oCmds.hasName("schema-changed"))
                {
                    getSync().setSchemaChanged(true);
                }
                else if (!processServerErrors(oCmds))
                {
                    getDB().startTransaction();

                    if (SyncEngine.getSourceOptions().getBoolProperty(getID(), "pass_through"))
                    {
                        if (m_bSchemaSource)
                        {
                            getDB().executeSQL("DELETE FROM " + getName());
                        }
                        else
                        {
                            getDB().executeSQL("DELETE FROM object_values WHERE source_id=?", getID());
                        }
                    }

                    if (oCmds.hasName("metadata") && getSync().isContinueSync())
                    {
                        String strMetadata = oCmds.getString("metadata");
                        getDB().executeSQL("UPDATE sources SET metadata=? WHERE source_id=?", strMetadata, getID());
                    }
                    if (oCmds.hasName("links") && getSync().isContinueSync())
                    {
                        processSyncCommand("links", oCmds.getEntry("links"), true);
                    }
                    if (oCmds.hasName("delete") && getSync().isContinueSync())
                    {
                        processSyncCommand("delete", oCmds.getEntry("delete"), true);
                    }
                    if (oCmds.hasName("insert") && getSync().isContinueSync())
                    {
                        processSyncCommand("insert", oCmds.getEntry("insert"), true);
                    }

                    PROF.STOP("Data");

                    PROF.START("DB");
                    getDB().endTransaction();
                    PROF.STOP("DB");

                    getNotify().fireObjectsNotification();
                }
            }

            PROF.START("Data1");
            if (getCurPageCount() > 0)
            {
                getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");
            }
            PROF.STOP("Data1");
        }
Beispiel #18
0
        private void GetResponseCallback(IAsyncResult asyncResult)
        {
            HttpWebResponse response = null;

            try
            {
                response = m_webRequest.EndGetResponse(asyncResult) as HttpWebResponse;
            }
            catch (WebException e)
            {
                if (!m_bCancel)
                {
                    LOG.ERROR("EndGetResponse", e);
                    response = (HttpWebResponse)e.Response;
                    m_code   = response != null?Convert.ToInt32(response.StatusCode) : 0;
                }
                else
                {
                    LOG.INFO("Request was cancelled by user.");
                }
            }
            catch (ArgumentNullException e)
            {
                m_code = 1;
                m_respWaitEvent.Set();
                return;
            }
            catch (Exception e)
            {
                ///LOG.ERROR("EndGetResponse", e);
                m_respWaitEvent.Set();
                return;
            }

            if (response == null || m_bCancel)
            {
                m_respWaitEvent.Set();
                return;
            }

            Stream stream = response.GetResponseStream();

            m_code = Convert.ToInt32(response.StatusCode);
            LOG.INFO("getResponseCode : " + m_code);

            m_strCookies = makeClientCookie(response);

            readHeaders(m_headers, response);
            copyHashtable(m_OutHeaders, m_headers);

            try
            {
                if (m_code >= 400)
                {
                    LOG.ERROR("Error retrieving data: " + m_code);
                    if (m_code == Convert.ToInt32(HttpStatusCode.Unauthorized) && m_oSession != null)
                    {
                        LOG.ERROR("Unauthorize error.Client will be logged out");
                        m_oSession.logout();
                    }

                    m_strRespBody = readFully(stream, getResponseEncoding());
                    LOG.TRACE("Response body: " + m_strRespBody);
                }
                else
                {
                    long len = response.ContentLength;
                    LOG.INFO("fetchRemoteData data size:" + len);

                    m_strRespBody = readFully(stream, getResponseEncoding());
                    LOG.INFO("fetchRemoteData data readFully.");
                }
            }
            finally
            {
                stream.Close();
                response.Close();
                m_respWaitEvent.Set();
            }
        }
Beispiel #19
0
        public static object dosync(RubyModule /*!*/ self)
        {
            object res = null;

            try
            {
                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, false));

                res = SyncThread.getInstance().getRetValue();
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("dosync", ex);
                throw rubyEx;
            }

            return(res);
        }
Beispiel #20
0
        void doFireSyncNotification(SyncSource src, boolean bFinish, int nErrCode, String strError, String strParams, String strServerError)
        {
            if (getSync().isStoppedByUser())
            {
                return;
            }

            try{
                SyncNotification pSN = null;

                String  strBody          = "";
                boolean bRemoveAfterFire = bFinish;
                {
                    lock (m_mxSyncNotifications){
                        pSN = getSyncNotifyBySrc(src);
                        if (pSN == null)
                        {
                            return;
                        }

                        strBody = "";

                        if (src != null)
                        {
                            strBody += "total_count=" + src.getTotalCount();
                            strBody += "&processed_count=" + src.getCurPageCount();
                            strBody += "&processed_objects_count=" + getLastSyncObjectCount(src.getID());
                            strBody += "&cumulative_count=" + src.getServerObjectsCount();
                            strBody += "&source_id=" + src.getID();
                            strBody += "&source_name=" + src.getName();
                        }

                        if (strParams.length() > 0)
                        {
                            strBody += (strBody.length() > 0 ? "&" : "") + strParams;
                        }
                        else
                        {
                            strBody += (strBody.length() > 0 ? "&" : "") + "sync_type=incremental";
                        }

                        strBody += "&status=";
                        if (bFinish)
                        {
                            if (nErrCode == RhoAppAdapter.ERR_NONE)
                            {
                                if (getSync().isSchemaChanged())
                                {
                                    strBody += "schema_changed";
                                }
                                else
                                {
                                    strBody += (src == null && strParams.length() == 0) ? "complete" : "ok";
                                }
                            }
                            else
                            {
                                if (getSync().isStoppedByUser())
                                {
                                    nErrCode = RhoAppAdapter.ERR_CANCELBYUSER;
                                }

                                strBody += "error";
                                strBody += "&error_code=" + nErrCode;

                                if (strError != null && strError.length() > 0)
                                {
                                    strBody += "&error_message=" + URI.urlEncode(strError);
                                }
                                else if (src != null)
                                {
                                    strBody += "&error_message=" + URI.urlEncode(src.m_strError);
                                }

                                if (strServerError != null && strServerError.length() > 0)
                                {
                                    strBody += "&" + strServerError;
                                }
                                else if (src != null && src.m_strServerError != null && src.m_strServerError.length() > 0)
                                {
                                    strBody += "&" + src.m_strServerError;
                                }
                            }

                            if (src != null)
                            {
                                strBody += makeCreateObjectErrorBody(src.getID());
                            }
                        }
                        else
                        {
                            strBody += "in_progress";
                        }

                        strBody += "&rho_callback=1";
                        if (pSN.m_strParams != null && pSN.m_strParams.length() > 0)
                        {
                            if (!pSN.m_strParams.startsWith("&"))
                            {
                                strBody += "&";
                            }

                            strBody += pSN.m_strParams;
                        }

                        bRemoveAfterFire = bRemoveAfterFire && pSN.m_bRemoveAfterFire;
                    }
                }
                if (bRemoveAfterFire)
                {
                    clearNotification(src);
                }

                LOG.INFO("Fire notification. Source : " + (src != null ? (src).getName():"") + "; " + pSN.ToString());

                if (callNotify(pSN, strBody))
                {
                    clearNotification(src);
                }
            }catch (Exception exc)
            {
                LOG.ERROR("Fire notification failed.", exc);
            }
        }
Beispiel #21
0
        public static object dosync(RubyModule /*!*/ self, params object[] args)
        {
            object res = null;

            try
            {
                boolean bShowStatus  = true;
                String  query_params = "";
                if (args != null && args.Length > 0)
                {
                    if (args[0] is int)
                    {
                        bShowStatus = ((int)args[0]).Equals(1);
                    }
                    else if (args[0] is bool)
                    {
                        bShowStatus = (bool)args[0];
                    }
                    else
                    {
                        String str = ((MutableString)args[0]).ToString();
                        //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str);
                        bShowStatus = "true".equalsIgnoreCase(str);
                    }
                }

                if (args != null && args.Length > 1)
                {
                    query_params = ((MutableString)args[1]).ToString();
                }

                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, bShowStatus, query_params));

                res = SyncThread.getInstance().getRetValue();
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("dosync", ex);
                throw rubyEx;
            }

            return(res);
        }