2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.so.apihandler.common;
26 import org.apache.http.impl.client.HttpClientBuilder;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.core.env.Environment;
29 import org.springframework.stereotype.Component;
32 public class RequestClientFactory {
35 private Environment env;
37 // based on URI, returns BPEL, CamundaTask or Camunda client
38 public RequestClient getRequestClient(String orchestrationURI) {
39 RequestClient retClient;
42 if (orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)) {
43 url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
44 retClient = new CamundaTaskClient();
46 url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
47 retClient = new CamundaClient();
49 retClient.setClient(HttpClientBuilder.create().build());
50 retClient.setProps(env);
51 retClient.setUrl(url);
56 public Environment getEnv() {
60 public void setEnv(Environment env) {