if (ObjectHelper.isEmpty(contextId)) {
/** * Whether the destination name has either queue or temp queue prefix. * * @param destination the destination * @return <tt>true</tt> if queue or temp-queue prefix, <tt>false</tt> otherwise */ public static boolean isQueuePrefix(String destination) { if (ObjectHelper.isEmpty(destination)) { return false; } return destination.startsWith(QUEUE_PREFIX) || destination.startsWith(TEMP_QUEUE_PREFIX); }
/** * Whether the destination name has either topic or temp topic prefix. * * @param destination the destination * @return <tt>true</tt> if topic or temp-topic prefix, <tt>false</tt> otherwise */ public static boolean isTopicPrefix(String destination) { if (ObjectHelper.isEmpty(destination)) { return false; } return destination.startsWith(TOPIC_PREFIX) || destination.startsWith(TEMP_TOPIC_PREFIX); }
protected void checkName(Object value, String name) { if (ObjectHelper.isEmpty(value)) { LOG.warn("The " + name + " of " + this.getEndpointUri() + " is empty, cxf will try to load the first one in wsdl for you."); } }
void checkName(Object value, String name) { if (ObjectHelper.isEmpty(value)) { LOG.warn("The " + name + " of " + this.getEndpointUri() + " is empty, cxf will try to load the first one in wsdl for you."); } }
public static void checkServiceClassName(String className) throws CamelException { if (ObjectHelper.isEmpty(className)) { throw new CamelException("serviceClass is required for CXF endpoint configuration"); } }
private void compare(long expected, Exchange exchange) { long update = exchange.getIn().getBody(Long.class); if (ObjectHelper.isEmpty(expected)) { throw new IllegalArgumentException("Expected value must be specified"); } exchange.getOut().setBody(this.atomicnumber.compareAndSet(expected, update)); }
private void restoreDroplet(Exchange exchange) throws Exception { if (ObjectHelper.isEmpty(exchange.getIn().getHeader(DigitalOceanHeaders.IMAGE_ID))) { throw new IllegalArgumentException(DigitalOceanHeaders.IMAGE_ID + " must be specified"); } Action action = getEndpoint().getDigitalOceanClient().restoreDroplet(dropletId, exchange.getIn().getHeader(DigitalOceanHeaders.IMAGE_ID, Integer.class)); LOG.trace("DropletAction Restore [{}] ", action); exchange.getOut().setBody(action); }
private void renameDroplet(Exchange exchange) throws Exception { if (ObjectHelper.isEmpty(exchange.getIn().getHeader(DigitalOceanHeaders.NAME))) { throw new IllegalArgumentException(DigitalOceanHeaders.NAME + " must be specified"); } Action action = getEndpoint().getDigitalOceanClient().renameDroplet(dropletId, exchange.getIn().getHeader(DigitalOceanHeaders.NAME, String.class)); LOG.trace("Rename Droplet {} : [{}] ", dropletId, action); exchange.getOut().setBody(action); }
private void untagDroplet(Exchange exchange) throws Exception { if (ObjectHelper.isEmpty(exchange.getIn().getHeader(DigitalOceanHeaders.NAME))) { throw new IllegalArgumentException(DigitalOceanHeaders.NAME + " must be specified"); } ArrayList<Resource> resources = new ArrayList<>(1); resources.add(new Resource(dropletId.toString(), ResourceType.DROPLET)); Response response = getEndpoint().getDigitalOceanClient().untagResources(dropletId.toString(), resources); LOG.trace("Untag Droplet {} : [{}] ", dropletId, response); exchange.getOut().setBody(response); }
@Override public void onScanningForFiles(String host, String directory) { if (ObjectHelper.isEmpty(directory)) { doLogVerbose("Scanning for new files to download from host: " + host); } else { doLogVerbose("Scanning for new files to download from host: " + host + " in directory: " + directory); } }
@Override public NettyCamelState getState(ChannelHandlerContext ctx, Channel channel, Object msg) { String cid = getResponseCorrelationId(msg); if (ObjectHelper.isEmpty(cid)) { LOG.warn("CorrelationID is missing from response message."); return null; } LOG.debug("getState({}) on channel: {}", cid, channel.id()); // lets remove after use as its no longer needed return map.remove(cid); }
protected void doGetDeployment(Exchange exchange, String operation) throws Exception { Deployment deployment = null; String deploymentName = exchange.getIn().getHeader(KubernetesConstants.KUBERNETES_DEPLOYMENT_NAME, String.class); if (ObjectHelper.isEmpty(deploymentName)) { LOG.error("Get a specific Deployment require specify a Deployment name"); throw new IllegalArgumentException("Get a specific Deployment require specify a Deployment name"); } deployment = getEndpoint().getKubernetesClient().apps().deployments().withName(deploymentName).get(); MessageHelper.copyHeaders(exchange.getIn(), exchange.getOut(), true); exchange.getOut().setBody(deployment); }
@Override public String generateUuid(MailEndpoint mailEndpoint, Message message) { String answer = generateMessageIdHeader(message); if (answer == null) { answer = generateMessageHash(message); } // fallback and use message number if (answer == null || ObjectHelper.isEmpty(answer)) { answer = Integer.toString(message.getMessageNumber()); } return answer; }
@Override protected Result verifyParameters(Map<String, Object> parameters) { ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS); if (ObjectHelper.isEmpty(parameters.get("token")) || ObjectHelper.isEmpty(parameters.get("webhookUrl"))) { builder.error(ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.GENERIC, "You must specify a webhookUrl and a token").parameterKey("webhookUrl").parameterKey("token").build()); } return builder.build(); }
public HazelcastSedaEndpoint(final HazelcastInstance hazelcastInstance, final String uri, final HazelcastDefaultComponent component, final HazelcastSedaConfiguration configuration) { super(hazelcastInstance, uri, component); this.queue = hazelcastInstance.getQueue(configuration.getQueueName()); this.configuration = configuration; if (ObjectHelper.isEmpty(configuration.getQueueName())) { throw new IllegalArgumentException("Queue name is missing."); } setCommand(HazelcastCommand.seda); }
public void validate() throws IllegalArgumentException { ObjectHelper.notEmpty(userName, "userName"); if (ObjectHelper.isEmpty(userPassword) && secureStorage == null) { throw new IllegalArgumentException("Property userPassword or secureStorage is required"); } ObjectHelper.notEmpty(clientId, "clientId"); ObjectHelper.notEmpty(clientSecret, "clientSecret"); ObjectHelper.notEmpty(redirectUri, "redirectUri"); } }
protected void doDeleteTag(Exchange exchange, String operation) throws Exception { if (ObjectHelper.isEmpty(endpoint.getTagName())) { throw new IllegalArgumentException("Tag Name must be specified to execute " + operation); } try { git.tagDelete().setTags(endpoint.getTagName()).call(); } catch (Exception e) { LOG.error("There was an error in Git {} operation", operation); throw e; } }
private void getImageActions(Exchange exchange) throws Exception { Integer imageId = exchange.getIn().getHeader(DigitalOceanHeaders.ID, Integer.class); if (ObjectHelper.isEmpty(imageId)) { throw new IllegalArgumentException(DigitalOceanHeaders.ID + " must be specified"); } Actions actions = getEndpoint().getDigitalOceanClient().getAvailableImageActions(imageId, configuration.getPage(), configuration.getPerPage()); LOG.trace("Actions for Image {} : page {} / {} per page [{}] ", imageId, configuration.getPage(), configuration.getPerPage(), actions.getActions()); exchange.getOut().setBody(actions.getActions()); }
@Override public RemoteFileConsumer<FTPFile> createConsumer(Processor processor) throws Exception { if (isResumeDownload() && ObjectHelper.isEmpty(getLocalWorkDirectory())) { throw new IllegalArgumentException("The option localWorkDirectory must be configured when resumeDownload=true"); } if (isResumeDownload() && !getConfiguration().isBinary()) { throw new IllegalArgumentException("The option binary must be enabled when resumeDownload=true"); } return super.createConsumer(processor); }