Examples of SyncResult


Examples of com.android.ddmlib.SyncService.SyncResult

   * @throws SyncException
   */
  public static void pushFile(IDevice device, final String[] localFrom, final FileEntry remoteTo)
        throws TimeoutException, AdbCommandRejectedException, IOException{
    SyncService server = device.getSyncService();
    SyncResult result = server.push(localFrom, remoteTo, SyncService.getNullProgressMonitor());
    UIHelper.showMessageDialog(result.getMessage());
//        new SyncProgressMonitorAdapter(){
//      @Override
//      public void stop() {
//        UIHelper.showMessageDialog("upload  " + localFrom[0] + " to " + remoteTo.getFullPath() + " stop");
//
View Full Code Here

Examples of com.android.ddmlib.SyncService.SyncResult

   * @param localTo
   */
  public static void pullFile(IDevice device, final FileEntry remoteFrom, final String localTo)
      throws TimeoutException, AdbCommandRejectedException, IOException{
    SyncService server = device.getSyncService();
    SyncResult result = server.pullFile(remoteFrom, localTo, SyncService.getNullProgressMonitor());
    UIHelper.showMessageDialog(result.getMessage());
//        new SyncProgressMonitorAdapter(){
//      @Override
//      public void stop() {
//        UIHelper.showMessageDialog("download " + remoteFrom.getName() + " to " + localTo + " stop");
////        server.
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult

                    .setForceGroupSync(true)
                    .setForceUserSync(true);
            List<String> result = new ArrayList<String>();
            for (String userId: userIds) {
                try {
                    SyncResult r = context.sync(userId);
                    systemSession.save();
                    result.add(getJSONString(r));
                } catch (SyncException e) {
                    log.warn("Error while syncing user {}", userId, e);
                } catch (RepositoryException e) {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult

                Iterator<SyncedIdentity> iter = handler.listIdentities(userMgr);
                while (iter.hasNext()) {
                    SyncedIdentity id = iter.next();
                    if (isMyIDP(id)) {
                        try {
                            SyncResult r = context.sync(id.getId());
                            systemSession.save();
                            list.add(getJSONString(r));
                        } catch (SyncException e) {
                            list.add(getJSONString(id, e));
                        } catch (RepositoryException e) {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult

            for (String externalId: externalIds) {
                ExternalIdentityRef ref = ExternalIdentityRef.fromString(externalId);
                try {
                    ExternalIdentity id = idp.getIdentity(ref);
                    if (id != null) {
                        SyncResult r = context.sync(id);
                        systemSession.save();
                        list.add(getJSONString(r));
                    } else {
                        SyncResult r = new SyncResultImpl(
                                new SyncedIdentityImpl("", ref, false, -1),
                                SyncResult.Status.NO_SUCH_IDENTITY
                        );
                        list.add(getJSONString(r));
                    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult

            try {
                Iterator<ExternalUser> iter = idp.listUsers();
                while (iter.hasNext()) {
                    ExternalUser user = iter.next();
                    try {
                        SyncResult r = context.sync(user);
                        systemSession.save();
                        list.add(getJSONString(r));
                    } catch (SyncException e) {
                        list.add(getJSONString(user.getExternalId(), e));
                    } catch (RepositoryException e) {
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult

        public String[] purgeOrphanedUsers() {
            context.setKeepMissing(false);
            List<String> result = new ArrayList<String>();
            for (String userId: listOrphanedUsers()) {
                try {
                    SyncResult r = context.sync(userId);
                    systemSession.save();
                    result.add(getJSONString(r));
                } catch (SyncException e) {
                    log.warn("Error while syncing user {}", userId, e);
                } catch (RepositoryException e) {
View Full Code Here

Examples of org.apache.syncope.core.sync.SyncResult

        if (!syncTask.isPerformCreate()) {
            LOG.debug("SyncTask not configured for create");
            return Collections.<SyncResult>emptyList();
        }

        final SyncResult result = new SyncResult();
        result.setOperation(ResourceOperation.CREATE);
        result.setSubjectType(attrUtil.getType());
        result.setStatus(SyncResult.Status.SUCCESS);

        AbstractAttributableTO subjectTO = connObjectUtil.getAttributableTO(delta.getObject(), syncTask, attrUtil);

        delta = actions.beforeCreate(this, delta, subjectTO);

        if (dryRun) {
            result.setId(0L);
            if (subjectTO instanceof UserTO) {
                result.setName(((UserTO) subjectTO).getUsername());
            }
            if (subjectTO instanceof RoleTO) {
                result.setName(((RoleTO) subjectTO).getName());
            }
        } else {
            try {
                if (AttributableType.USER == attrUtil.getType()) {
                    Boolean enabled = readEnabled(delta.getObject());
                    WorkflowResult<Map.Entry<Long, Boolean>> created =
                            uwfAdapter.create((UserTO) subjectTO, true, enabled);

                    List<PropagationTask> tasks = propagationManager.getUserCreateTaskIds(created,
                            ((UserTO) subjectTO).getPassword(), subjectTO.getVirtualAttributes(),
                            Collections.singleton(syncTask.getResource().getName()));

                    taskExecutor.execute(tasks);

                    notificationManager.createTasks(created.getResult().getKey(), created.getPerformedTasks());

                    subjectTO = userDataBinder.getUserTO(created.getResult().getKey());

                    result.setId(created.getResult().getKey());
                    result.setName(((UserTO) subjectTO).getUsername());
                }
                if (AttributableType.ROLE == attrUtil.getType()) {
                    WorkflowResult<Long> created = rwfAdapter.create((RoleTO) subjectTO);
                    AttributeTO roleOwner = subjectTO.getAttributeMap().get(StringUtils.EMPTY);
                    if (roleOwner != null) {
                        roleOwnerMap.put(created.getResult(), roleOwner.getValues().iterator().next());
                    }

                    EntitlementUtil.extendAuthContext(created.getResult());

                    List<PropagationTask> tasks = propagationManager.getRoleCreateTaskIds(created,
                            subjectTO.getVirtualAttributes(), Collections.singleton(syncTask.getResource().getName()));

                    taskExecutor.execute(tasks);

                    subjectTO = roleDataBinder.getRoleTO(created.getResult());

                    result.setId(created.getResult());
                    result.setName(((RoleTO) subjectTO).getName());
                }

            } catch (PropagationException e) {
                // A propagation failure doesn't imply a synchronization failure.
                // The propagation exception status will be reported into the propagation task execution.
                LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
            } catch (Exception e) {
                result.setStatus(SyncResult.Status.FAILURE);
                result.setMessage(e.getMessage());
                LOG.error("Could not create {} {} ", attrUtil.getType(), delta.getUid().getUidValue(), e);
            }
        }

        actions.after(this, delta, subjectTO, result);
View Full Code Here

Examples of org.apache.syncope.core.sync.SyncResult

        List<SyncResult> updResults = new ArrayList<SyncResult>();

        for (Long id : subjects) {
            LOG.debug("About to update {}", id);

            final SyncResult result = new SyncResult();
            result.setOperation(ResourceOperation.UPDATE);
            result.setSubjectType(attrUtil.getType());
            result.setStatus(SyncResult.Status.SUCCESS);
            result.setId(id);

            try {
                if (AttributableType.USER == attrUtil.getType()) {
                    UserTO updated = updateUser(id, delta, dryRun, result);
                    result.setName(updated.getUsername());
                }

                if (AttributableType.ROLE == attrUtil.getType()) {
                    RoleTO updated = updateRole(id, delta, dryRun, result);
                    result.setName(updated.getName());
                }
            } catch (PropagationException e) {
                // A propagation failure doesn't imply a synchronization failure.
                // The propagation exception status will be reported into the propagation task execution.
                LOG.error("Could not propagate {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
            } catch (Exception e) {
                result.setStatus(SyncResult.Status.FAILURE);
                result.setMessage(e.getMessage());

                LOG.error("Could not update {} {}", attrUtil.getType(), delta.getUid().getUidValue(), e);
            }
            results.add(result);
View Full Code Here

Examples of org.apache.syncope.core.sync.SyncResult

                AbstractAttributableTO subjectTO = AttributableType.USER == attrUtil.getType()
                        ? userDataBinder.getUserTO(id)
                        : roleDataBinder.getRoleTO(id);
                delta = actions.beforeDelete(this, delta, subjectTO);

                final SyncResult result = new SyncResult();
                result.setId(id);
                if (subjectTO instanceof UserTO) {
                    result.setName(((UserTO) subjectTO).getUsername());
                }
                if (subjectTO instanceof RoleTO) {
                    result.setName(((RoleTO) subjectTO).getName());
                }
                result.setOperation(ResourceOperation.DELETE);
                result.setSubjectType(attrUtil.getType());
                result.setStatus(SyncResult.Status.SUCCESS);

                if (!dryRun) {
                    try {
                        List<PropagationTask> tasks = Collections.<PropagationTask>emptyList();
                        if (AttributableType.USER == attrUtil.getType()) {
                            tasks = propagationManager.getUserDeleteTaskIds(id, syncTask.getResource().getName());
                            notificationManager.createTasks(id, Collections.<String>singleton("delete"));
                        }
                        if (AttributableType.ROLE == attrUtil.getType()) {
                            tasks = propagationManager.getRoleDeleteTaskIds(id, syncTask.getResource().getName());
                        }
                        taskExecutor.execute(tasks);
                    } catch (Exception e) {
                        // A propagation failure doesn't imply a synchronization failure.
                        // The propagation exception status will be reported into the propagation task execution.
                        LOG.error("Could not propagate user " + id, e);
                    }

                    try {
                        if (AttributableType.USER == attrUtil.getType()) {
                            uwfAdapter.delete(id);
                        }
                        if (AttributableType.ROLE == attrUtil.getType()) {
                            rwfAdapter.delete(id);
                        }
                    } catch (Exception e) {
                        result.setStatus(SyncResult.Status.FAILURE);
                        result.setMessage(e.getMessage());
                        LOG.error("Could not delete {} {}", attrUtil.getType(), id, e);
                    }
                }

                actions.after(this, delta, subjectTO, result);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.