![JAR search and dependency download from the Maven repository](/logo.png)
com.adobe.campaign.tests.bridge.service.JavaCalls Maven / Gradle / Ivy
/*
* Copyright 2022 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it.
*/
package com.adobe.campaign.tests.bridge.service;
import com.adobe.campaign.tests.bridge.service.exceptions.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
public class JavaCalls {
private static final Logger log = LogManager.getLogger();
private Map assertions;
private Long timeout;
private Map callContent;
private Properties environmentVariables;
@JsonIgnore
private IntegroBridgeClassLoader localClassLoader;
public JavaCalls() {
callContent = new LinkedHashMap<>();
assertions = new LinkedHashMap<>();
environmentVariables = new Properties();
setLocalClassLoader(new IntegroBridgeClassLoader());
timeout = Long.parseLong(ConfigValueHandlerIBS.DEFAULT_CALL_TIMEOUT.fetchValue());
}
public Map getCallContent() {
return callContent;
}
/**
* Calls the underlying method call
*
* @param in_key the key for identifying the java call
* @return A map of the results
*/
public Object call(String in_key) {
if (!this.callContent.containsKey(in_key)) {
throw new CallDefinitionNotFoundException("Could not find a call definition with the given key " + in_key);
}
Object lr_object;
ExecutorService executor = Executors.newSingleThreadExecutor();
Callable caller = () -> { // Lambda Expression
return this.getCallContent().get(in_key).call(getLocalClassLoader());
};
Future
© 2015 - 2025 Weber Informatics LLC | Privacy Policy