Package org.atomojo.app.sync

Examples of org.atomojo.app.sync.Synchronizer


      final String name = getRequest().getAttributes().get("name").toString();

      SyncProcess proc = db.getSyncProcess(name);
     
      if (proc!=null) {
         Synchronizer sync = null;
         if (proc.isPullSynchronization()) {
            User user = (User)getRequest().getAttributes().get(App.USER_ATTR);
            sync = new PullSynchronizer(getContext().getLogger(),getApplication().getMetadataService(),user,db,storage,proc);
            ((PullSynchronizer)sync).setAdditive(proc.isAdditive());
         } else {
            sync = new PushSynchronizer(getContext().getLogger(),db,storage,proc);
         }
         try {
            sync.setSynchronizationAt(new Date());
            sync.sync();
            if (sync.getErrorCount()>0) {
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
               return new StringRepresentation("There were "+sync.getErrorCount()+" synchronization errors.  See the log for details.");
            } else {
               getResponse().setStatus(Status.SUCCESS_OK);
               return null;
            }
         } catch (TargetNotAvailableException ex) {
View Full Code Here

TOP

Related Classes of org.atomojo.app.sync.Synchronizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.