2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.apihandler.common;
26 import org.apache.http.impl.client.DefaultHttpClient;
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) throws IllegalStateException{
39 RequestClient retClient;
42 if(orchestrationURI.contains(CommonConstants.TASK_SEARCH_STR)){
43 url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
44 retClient = new CamundaTaskClient();
47 url = env.getProperty(CommonConstants.CAMUNDA_URL) + orchestrationURI;
48 retClient = new CamundaClient();
50 retClient.setClient(new DefaultHttpClient());
51 retClient.setProps(env);
52 retClient.setUrl(url);
57 public Environment getEnv() {
61 public void setEnv(Environment env) {