Package org.apache.syncope.core.propagation

Examples of org.apache.syncope.core.propagation.ConnectorFacadeProxy


                new HashMap<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject>();

        for (ExternalResource resource : owner.getResources()) {
            LOG.debug("Retrieve remote object from '{}'", resource.getName());
            try {
                final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);

                final SchemaMappingUtil.SchemaMappingsWrapper mappings = new SchemaMappingUtil.SchemaMappingsWrapper(
                        resource.getMappings());

                final String accountId = SchemaMappingUtil.getAccountIdValue(owner, mappings.getAccountIdMapping());

                LOG.debug("Search for object with accountId '{}'", accountId);

                if (StringUtils.isNotBlank(accountId)) {
                    // Retrieve attributes to get
                    final Set<String> extAttrNames = new HashSet<String>();

                    for (Collection<SchemaMapping> virAttrMappings : mappings.getuVirMappings().values()) {
                        for (SchemaMapping virAttrMapping : virAttrMappings) {
                            extAttrNames.add(SchemaMappingUtil.getExtAttrName(virAttrMapping));
                        }
                    }

                    // Search for remote object
                    if (extAttrNames != null) {
                        final OperationOptionsBuilder oob = new OperationOptionsBuilder();
                        oob.setAttributesToGet(extAttrNames);

                        final ConnectorObject connectorObject = connector.getObject(ObjectClass.ACCOUNT, new Uid(
                                accountId), oob.build());

                        if (connectorObject != null) {
                            remoteObjects.put(mappings, connectorObject);
                        }
View Full Code Here


            throw new JobExecutionException("Task " + taskId + " isn't a SyncTask");
        }

        final SyncTask syncTask = (SyncTask) this.task;

        ConnectorFacadeProxy connector;
        try {
            connector = connInstanceLoader.getConnector(syncTask.getResource());
        } catch (Exception e) {
            final String msg = String.format("Connector instance bean for resource %s and connInstance %s not found",
                    syncTask.getResource(), syncTask.getResource().getConnector());

            throw new JobExecutionException(msg, e);
        }

        final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());

        if (accountIdMap == null) {
            throw new JobExecutionException("Invalid account id mapping for resource " + syncTask.getResource());
        }

        LOG.debug("Execute synchronization with token {}", syncTask.getResource().getSyncToken() != null
                ? syncTask.getResource().getSyncToken().getValue()
                : null);

        final List<SyncResult> results = new ArrayList<SyncResult>();

        actions.beforeAll(syncTask);

        try {
            final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy();

            final ConflictResolutionAction conflictResolutionAction = syncPolicy != null
                    && syncPolicy.getSpecification() != null
                    ? ((SyncPolicySpec) syncPolicy.getSpecification()).getConflictResolutionAction()
                    : ConflictResolutionAction.IGNORE;

            if (syncTask.isFullReconciliation()) {
                connector.getAllObjects(ObjectClass.ACCOUNT, new SyncResultsHandler() {

                    @Override
                    public boolean handle(final SyncDelta delta) {
                        try {

                            return results.addAll(handleDelta(syncTask, delta, conflictResolutionAction, dryRun));

                        } catch (JobExecutionException e) {
                            LOG.error("Reconciliation failed", e);
                            return false;
                        }
                    }
                }, connector.getOperationOptions(syncTask.getResource()));
            } else {
                connector.sync(syncTask.getResource().getSyncToken(), new SyncResultsHandler() {

                    @Override
                    public boolean handle(final SyncDelta delta) {
                        try {

                            return results.addAll(handleDelta(syncTask, delta, conflictResolutionAction, dryRun));

                        } catch (JobExecutionException e) {
                            LOG.error("Synchronization failed", e);
                            return false;
                        }
                    }
                }, connector.getOperationOptions(syncTask.getResource()));
            }

            if (!dryRun && !syncTask.isFullReconciliation()) {
                try {
                    ExternalResource resource = resourceDAO.find(syncTask.getResource().getName());
                    resource.setSyncToken(connector.getLatestSyncToken());
                    resourceDAO.save(resource);

                } catch (Exception e) {
                    throw new JobExecutionException("While updating SyncToken", e);
                }
View Full Code Here

        final ConnInstance connInstanceClone = (ConnInstance) SerializationUtils.clone(connInstance);

        connInstanceClone.setConfiguration(configuration);

        return new ConnectorFacadeProxy(connInstanceClone, connBundleManager);
    }
View Full Code Here

        return new ConnectorFacadeProxy(connInstanceClone, connBundleManager);
    }

    public void registerConnector(final ExternalResource resource) throws NotFoundException {

        final ConnectorFacadeProxy connector = createConnectorBean(resource);
        LOG.debug("Connector to be registered: {}", connector);

        final String beanName = getBeanName(resource);

        if (getBeanFactory().containsSingleton(beanName)) {
View Full Code Here

        ExternalResource resource = resourceDAO.find(resourceName);
        if (resource == null) {
            throw new NotFoundException("Resource '" + resourceName + "'");
        }

        final ConnectorFacadeProxy connector = connLoader.getConnector(resource);

        final ConnectorObject connectorObject = connector.getObject(ObjectClass.ACCOUNT, new Uid(objectId), connector.
                getOperationOptions(resource));

        if (connectorObject == null) {
            throw new NotFoundException("Object " + objectId + " not found on resource " + resourceName);
        }
View Full Code Here

                new HashMap<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject>();

        for (ExternalResource resource : owner.getResources()) {
            LOG.debug("Retrieve remote object from '{}'", resource.getName());
            try {
                final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);

                final SchemaMappingUtil.SchemaMappingsWrapper mappings = new SchemaMappingUtil.SchemaMappingsWrapper(
                        resource.getMappings());

                final String accountId = SchemaMappingUtil.getAccountIdValue(owner, mappings.getAccountIdMapping());

                LOG.debug("Search for object with accountId '{}'", accountId);

                if (StringUtils.isNotBlank(accountId)) {
                    // Retrieve attributes to get
                    final Set<String> extAttrNames = new HashSet<String>();

                    for (Collection<SchemaMapping> virAttrMappings : mappings.getuVirMappings().values()) {
                        for (SchemaMapping virAttrMapping : virAttrMappings) {
                            extAttrNames.add(SchemaMappingUtil.getExtAttrName(virAttrMapping));
                        }
                    }

                    // Search for remote object
                    if (extAttrNames != null) {
                        final OperationOptionsBuilder oob = new OperationOptionsBuilder();
                        oob.setAttributesToGet(extAttrNames);

                        final ConnectorObject connectorObject = connector.getObject(ObjectClass.ACCOUNT, new Uid(
                                accountId), oob.build());

                        if (connectorObject != null) {
                            remoteObjects.put(mappings, connectorObject);
                        }
View Full Code Here

    @RequestMapping(method = RequestMethod.POST, value = "/check")
    @Transactional(readOnly = true)
    public ModelAndView check(final HttpServletResponse response, @RequestBody final ConnInstanceTO connectorTO)
            throws SyncopeClientCompositeErrorException, NotFoundException {

        final ConnectorFacadeProxy connector = new ConnectorFacadeProxy(binder.getConnInstance(connectorTO),
                bundleManager);

        boolean result;
        try {
            connector.test();
            result = true;

            auditManager.audit(Category.connector, ConnectorSubCategory.check, Result.success,
                    "Successfully checked connector: " + connectorTO);
        } catch (Exception ex) {
View Full Code Here

        ExternalResource resource = resourceDAO.find(resourceName);
        if (resource == null) {
            throw new NotFoundException("Resource '" + resourceName + "'");
        }

        final ConnectorFacadeProxy connector = connLoader.getConnector(resource);

        auditManager.audit(Category.connector, ConnectorSubCategory.readConnectorBean, Result.success,
                "Successfully read connector for resource: " + resourceName);

        return binder.getConnInstanceTO(connector.getActiveConnInstance());
    }
View Full Code Here

                new HashMap<SchemaMappingUtil.SchemaMappingsWrapper, ConnectorObject>();

        for (ExternalResource resource : owner.getResources()) {
            LOG.debug("Retrieve remote object from '{}'", resource.getName());
            try {
                final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);

                final SchemaMappingUtil.SchemaMappingsWrapper mappings = new SchemaMappingUtil.SchemaMappingsWrapper(
                        resource.getMappings());

                final String accountId = SchemaMappingUtil.getAccountIdValue(owner, mappings.getAccountIdMapping());

                LOG.debug("Search for object with accountId '{}'", accountId);

                if (StringUtils.isNotBlank(accountId)) {
                    // Retrieve attributes to get
                    final Set<String> extAttrNames = new HashSet<String>();

                    for (Collection<SchemaMapping> virAttrMappings : mappings.getuVirMappings().values()) {
                        for (SchemaMapping virAttrMapping : virAttrMappings) {
                            extAttrNames.add(SchemaMappingUtil.getExtAttrName(virAttrMapping));
                        }
                    }

                    // Search for remote object
                    if (extAttrNames != null) {
                        final OperationOptionsBuilder oob = new OperationOptionsBuilder();
                        oob.setAttributesToGet(extAttrNames);

                        final ConnectorObject connectorObject = connector.getObject(ObjectClass.ACCOUNT, new Uid(
                                accountId), oob.build());

                        if (connectorObject != null) {
                            remoteObjects.put(mappings, connectorObject);
                        }
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.propagation.ConnectorFacadeProxy

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.