- private static Client client = null;
-
- private MultivaluedHashMap<String, Object> commonHeaders;
-
- /** The logger. */
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerRestInterface.class);
-
- public SchedulerRestInterface() {
- super();
- }
-
- public void initRestClient()
- {
- System.out.println( "\t <== Starting to initialize rest client ");
-
- final String username;
- final String password;
-
- /*Setting user name based on properties*/
- String retrievedUsername = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_USER_NAME_VAL);
- if(retrievedUsername.isEmpty()) {
- username = "";
- } else {
- username = retrievedUsername;
- }
-
- /*Setting password based on properties*/
- String retrievedPassword = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_PASSWORD_VAL);
- if(retrievedPassword.isEmpty()) {
- password = "";
- } else {
- if (retrievedPassword.contains("OBF:")) {
- password = Password.deobfuscate(retrievedPassword);
- } else {
- password = retrievedPassword;
- }
- }
-
- String authString = username + ":" + password;
-
- byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
- String authStringEnc = new String(authEncBytes);
-
- commonHeaders = new MultivaluedHashMap<String, Object> ();
- commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc)));
-
- try {
- if ( !username.isEmpty() ) {
-
- client = HttpsBasicClient.getClient();
- }
- else {
-
- client = HttpBasicClient.getClient();
- }
- } catch (Exception e) {
- System.out.println( " <== Unable to initialize rest client ");
- }
-
- System.out.println( "\t<== Client Initialized \n");
- }
-
- @SuppressWarnings("unchecked")
- public <T> void Get (T t, String sourceId, String path, org.onap.vid.scheduler.RestObject<T> restObject ) throws Exception {
-
- String methodName = "Get";
- String url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path;
-
-
- System.out.println( "<== URL FOR GET : " + url + "\n");
+ private static final EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("scheduler");
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerRestInterface.class);
+ private static final String SUCCESSFUL_API_MESSAGE=" REST api GET was successful!";
+ private SyncRestClientInterface syncRestClient;
+ private Function<String, String> propertyGetter;
+ private Map<String, String> commonHeaders;