예제 #1
0
        public static void set_syncserver(RubyModule /*!*/ self, [NotNull] String /*!*/ syncserver)
        {
            try
            {
                SyncThread.stopSync();
                SyncThread.getSyncEngine().setSyncServer(syncserver);

                if (syncserver != null && syncserver.length() > 0)
                {
                    SyncThread.getInstance().start(SyncThread.epLow);
                    if (ClientRegister.getInstance() != null)
                    {
                        ClientRegister.getInstance().startUp();
                    }
                }
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("set_syncserver", ex);
                throw rubyEx;
            }
        }
예제 #2
0
        public static object dosearch(RubyModule /*!*/ self, [NotNull] RubyArray /*!*/ arSourcesR, [NotNull] String /*!*/ from, [NotNull] String /*!*/ strParams,
                                      [NotNull] bool /*!*/ bSearchSyncChanges, [NotNull] int /*!*/ nProgressStep, String /*!*/ strCallback, String /*!*/ strCallbackParams)
        {
            object res = null;

            try
            {
                SyncThread.stopSync();

                if (strCallback != null && strCallback.Length > 0)
                {
                    SyncThread.getSyncEngine().getNotify().setSearchNotification(strCallback, strCallbackParams);
                }

                Vector <String> arSources = RhoRuby.makeVectorStringFromArray(arSourcesR);

                SyncThread.getInstance().addQueueCommand(new SyncThread.SyncSearchCommand(from, strParams, arSources, bSearchSyncChanges, nProgressStep));

                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("dosearch", ex);
                throw rubyEx;
            }

            return(res);
        }
예제 #3
0
        public static void set_syncserver(RubyModule /*!*/ self, [NotNull] String /*!*/ syncserver)
        {
            SyncThread.stopSync();
            SyncThread.getSyncEngine().setSyncServer(syncserver);

            if (syncserver != null && syncserver.length() > 0)
            {
                SyncThread.getInstance().start(SyncThread.epLow);
                if (ClientRegister.getInstance() != null)
                {
                    ClientRegister.getInstance().startUp();
                }
            }
        }
예제 #4
0
        public static object dosearch(RubyModule /*!*/ self, [NotNull] RubyArray /*!*/ arSourcesR, [NotNull] String /*!*/ from, [NotNull] String /*!*/ strParams,
                                      [NotNull] bool /*!*/ bSearchSyncChanges, [NotNull] int /*!*/ nProgressStep, String /*!*/ strCallback, String /*!*/ strCallbackParams)
        {
            SyncThread.stopSync();

            if (strCallback != null && strCallback.Length > 0)
            {
                SyncThread.getSyncEngine().getNotify().setSearchNotification(strCallback, strCallbackParams);
            }

            Vector <String> arSources = RhoRuby.makeVectorStringFromArray(arSourcesR);

            SyncThread.getInstance().addQueueCommand(new SyncThread.SyncSearchCommand(from, strParams, arSources, bSearchSyncChanges, nProgressStep));

            return(SyncThread.getInstance().getRetValue());
        }
예제 #5
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);
        }
예제 #6
0
 public static void stop_sync(RubyModule /*!*/ self)
 {
     try
     {
         SyncThread.stopSync();
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("stop_sync", ex);
         throw rubyEx;
     }
 }
예제 #7
0
 public static void set_pollinterval(RubyModule /*!*/ self)
 {
     SyncThread.stopSync();
 }
예제 #8
0
 public static void logout(RubyModule /*!*/ self)
 {
     SyncThread.stopSync();
     SyncThread.getSyncEngine().stopSyncByUser();
     SyncThread.getSyncEngine().logout();
 }