@Override public void validate() { Future<String> future = asyncFacade.test(connector); try { future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } }
@Override public void test() { Future<String> future = asyncFacade.test(connector); try { future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } }
@Override public Set<ObjectClassInfo> getObjectClassInfo() { Future<Set<ObjectClassInfo>> future = asyncFacade.getObjectClassInfo(connector); try { return future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } }
@Override public SyncToken getLatestSyncToken(final ObjectClass objectClass) { SyncToken result = null; if (connInstance.getCapabilities().contains(ConnectorCapability.SYNC)) { Future<SyncToken> future = asyncFacade.getLatestSyncToken(connector, objectClass); try { result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } } else { LOG.info("getLatestSyncToken was attempted, although the " + "connector only has these capabilities: {}. No action.", connInstance.getCapabilities()); } return result; }
@Override public ConnectorObject getObject( final ObjectClass objectClass, final Attribute connObjectKey, final boolean ignoreCaseMatch, final OperationOptions options) { Future<ConnectorObject> future = null; if (connInstance.getCapabilities().contains(ConnectorCapability.SEARCH)) { future = asyncFacade.getObject(connector, objectClass, connObjectKey, ignoreCaseMatch, options); } else { LOG.info("Search was attempted, although the connector only has these capabilities: {}. No action.", connInstance.getCapabilities()); } try { return future == null ? null : future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } }
@Override public Uid create( final ObjectClass objectClass, final Set<Attribute> attrs, final OperationOptions options, final AtomicReference<Boolean> propagationAttempted) { Uid result = null; if (connInstance.getCapabilities().contains(ConnectorCapability.CREATE)) { propagationAttempted.set(true); Future<Uid> future = asyncFacade.create(connector, objectClass, attrs, options); try { result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } } else { LOG.info("Create was attempted, although the connector only has these capabilities: {}. No action.", connInstance.getCapabilities()); } return result; }
@Override public Uid authenticate(final String username, final String password, final OperationOptions options) { Uid result = null; if (connInstance.getCapabilities().contains(ConnectorCapability.AUTHENTICATE)) { Future<Uid> future = asyncFacade.authenticate( connector, username, new GuardedString(password.toCharArray()), options); try { result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } } else { LOG.info("Authenticate was attempted, although the connector only has these capabilities: {}. No action.", connInstance.getCapabilities()); } return result; }
@Override public void delete( final ObjectClass objectClass, final Uid uid, final OperationOptions options, final AtomicReference<Boolean> propagationAttempted) { if (connInstance.getCapabilities().contains(ConnectorCapability.DELETE)) { propagationAttempted.set(true); Future<Uid> future = asyncFacade.delete(connector, objectClass, uid, options); try { future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true); throw new TimeoutException("Request timeout"); } catch (Exception e) { LOG.error("Connector request execution failure", e); if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e.getCause()); } } } else { LOG.info("Delete for {} was attempted, although the connector only has these capabilities: {}. No action.", uid.getUidValue(), connInstance.getCapabilities()); } }
result = future.get(connInstance.getConnRequestTimeout(), TimeUnit.SECONDS); } catch (java.util.concurrent.TimeoutException e) { future.cancel(true);
prioritizedTasks.add(task); if (resource.getConnector().getConnRequestTimeout() != null && connRequestTimeout[0] < resource.getConnector().getConnRequestTimeout()) { connRequestTimeout[0] = resource.getConnector().getConnRequestTimeout(); LOG.debug("Upgrade request connection timeout to {}", connRequestTimeout);
connInstanceTO.setVersion(connInstance.getVersion()); connInstanceTO.setDisplayName(connInstance.getDisplayName()); connInstanceTO.setConnRequestTimeout(connInstance.getConnRequestTimeout()); connInstanceTO.setAdminRealm(connInstance.getAdminRealm().getFullPath()); connInstanceTO.setLocation(info.getLeft().toASCIIString());