public boolean isStartTlsEnabled() { if (additionalJavaMailProperties != null) { return ObjectHelper.equal(additionalJavaMailProperties.getProperty("mail." + protocol + ".starttls.enable"), "true", true) || ObjectHelper.equal(additionalJavaMailProperties.getProperty("mail." + protocol + ".starttls.required"), "true", true); } return false; }
@Override public boolean isLocal() { if (id == null) { return false; } return ObjectHelper.equal(id, localMember.getId()); }
@Override public boolean isLocal() { return ObjectHelper.equal(lockConfiguration.getPodName(), podName); }
@Override public ServiceDiscovery newInstance(CamelContext camelContext) throws Exception { if (ObjectHelper.equal("dns", lookup)) { return new KubernetesDnsServiceDiscovery(configuration); } else if (ObjectHelper.equal("dnssrv", lookup)) { return new KubernetesDnsSrvServiceDiscovery(configuration); } else if (ObjectHelper.equal("client", lookup)) { return new KubernetesClientServiceDiscovery(configuration); } return new KubernetesEnvServiceDiscovery(configuration); } }
private boolean isHealthy(ServiceHealth serviceHealth) { return serviceHealth.getChecks().stream().allMatch( check -> ObjectHelper.equal(check.getStatus(), "passing", true) ); }
@SuppressWarnings({"PMD.AvoidReassigningParameters", "PMD.AvoidDeeplyNestedIfStmts"}) @Override public Optional<ProcessorDefinition<?>> handle(Step step, final ProcessorDefinition<?> route, IntegrationRouteBuilder builder, String flowIndex, String stepIndex) { ObjectHelper.notNull(route, "route"); final Map<String, String> props = step.getConfiguredProperties(); final String action = props.getOrDefault("action", "set"); if (ObjectHelper.equal(action, "set", true)) { props.entrySet().stream() .filter(e -> !"action".equalsIgnoreCase(e.getKey())) .forEach(e-> route.setHeader(e.getKey()).constant(e.getValue())); } else if (ObjectHelper.equal(action, "remove", true)) { props.entrySet().stream() .filter(e -> !"action".equalsIgnoreCase(e.getKey())) .forEach(e-> route.removeHeaders(e.getKey())); } else { throw new IllegalArgumentException("Unknown action:" + action); } return Optional.of(route); } }
/** * Returns true if this state is for the given activity */ public boolean isActivity(ActivityRules activityRules) { return ObjectHelper.equal(getActivityDefinition(), activityRules.getActivityDefinition()); }
@Override public ServiceDiscovery newInstance(CamelContext camelContext) throws Exception { return ObjectHelper.equal("watch", type, true) ? new EtcdWatchServiceDiscovery(configuration) : new EtcdOnDemandServiceDiscovery(configuration); } }
@ClientCacheEntryRemoved public void onCacheEntryRemoved(ClientCacheEntryRemovedEvent<String> event) { if (ObjectHelper.equal(lockKey, event.getKey())) { run(); } }
private boolean validateProperty(Exchange exchange, String propertyName, String expectedValue) { String body = exchange.getIn().getBody(String.class); Properties props = JSONBeanUtil.parsePropertiesFromJSONBean(body); return ObjectHelper.equal(props.getProperty(propertyName), expectedValue); } }
/** * Returns the policy for the given ID creating one on the fly if required */ public Policy policy(String id) { for (Policy policy : policies) { if (ObjectHelper.equal(id, policy.getId())) { return policy; } } return addPolicy(new Policy(id)); }
@Override public boolean isLocal() { return (participant.getId() != null) ? ObjectHelper.equal(participant.getId(), localMember.getId()) : false; }
@CacheEntryRemoved public void onCacheEntryRemoved(CacheEntryEvent<Object, Object> event) { if (ObjectHelper.equal(lockKey, event.getKey())) { run(); } } @CacheEntryExpired
@ClientCacheEntryExpired public void onCacheEntryExpired(ClientCacheEntryExpiredEvent<String> event) { if (ObjectHelper.equal(lockKey, event.getKey())) { run(); } } }
@CacheEntryExpired public void onCacheEntryExpired(CacheEntryEvent<Object, Object> event) { if (ObjectHelper.equal(lockKey, event.getKey())) { run(); } } }
@Override public Optional<CamelClusterMember> getLeader() { if (leaderSelector == null || isStoppingOrStopped()) { return Optional.empty(); } try { Participant participant = leaderSelector.getLeader(); return ObjectHelper.equal(participant.getId(), localMember.getId()) ? Optional.of(localMember) : Optional.of(new CuratorClusterMember(participant)); } catch (KeeperException.NoNodeException e) { LOGGER.debug("Failed to get get master because node '{}' does not yet exist (error: '{}')", configuration.getBasePath(), e.getMessage()); return Optional.empty(); } catch (Exception e) { throw new RuntimeCamelException(e); } }
private boolean tryTakeLeadership() throws Exception { boolean result = false; try { EtcdKeysResponse response = getClient() .put(servicePath, serviceName) .prevExist(false) .ttl(ttl) .send() .get(); result = ObjectHelper.equal(serviceName, response.node.value); EtcdHelper.setIndex(index, response); } catch (EtcdException e) { if (!e.isErrorCode(EtcdErrorCode.NodeExist)) { throw e; } } return result; } }