import org.onap.clamp.clds.config.ClampProperties;\r
import org.onap.clamp.clds.exception.dcae.DcaeDeploymentException;\r
import org.onap.clamp.clds.util.LoggingUtils;\r
+import org.onap.clamp.util.HttpConnectionManager;\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.stereotype.Component;\r
\r
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeDispatcherServices.class);\r
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();\r
private final ClampProperties refProp;\r
- private final DcaeHttpConnectionManager dcaeHttpConnectionManager;\r
+ private final HttpConnectionManager dcaeHttpConnectionManager;\r
private static final String STATUS_URL_LOG = "Status URL extracted: ";\r
private static final String DCAE_URL_PREFIX = "/dcae-deployments/";\r
private static final String DCAE_URL_PROPERTY_NAME = "dcae.dispatcher.url";\r
private static final String DCAE_STATUS_FIELD = "status";\r
\r
@Autowired\r
- public DcaeDispatcherServices(ClampProperties refProp, DcaeHttpConnectionManager dcaeHttpConnectionManager) {\r
+ public DcaeDispatcherServices(ClampProperties refProp, HttpConnectionManager dcaeHttpConnectionManager) {\r
this.refProp = refProp;\r
this.dcaeHttpConnectionManager = dcaeHttpConnectionManager;\r
}\r
\r
+ /**\r
+ * Get the Operation Status from a specified URL with retry.\r
+ * @param operationStatusUrl\r
+ * The URL of the DCAE\r
+ * @return The status\r
+ * @throws InterruptedException Exception during the retry\r
+ */\r
public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {\r
String operationStatus = "";\r
for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {\r
\r
/**\r
* Get the Operation Status from a specified URL.\r
- *\r
* @param statusUrl\r
* The URL provided by a previous DCAE Query\r
* @return The status\r
Date startTime = new Date();\r
LoggingUtils.setTargetContext("DCAE", "getOperationStatus");\r
try {\r
- String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(statusUrl, "GET", null, null);\r
+ String responseStr = dcaeHttpConnectionManager.doHttpRequest(statusUrl, "GET", null,\r
+ null, "DCAE", null,\r
+ null);\r
JSONObject jsonObj = parseResponse(responseStr);\r
String operationType = (String) jsonObj.get("operationType");\r
String status = (String) jsonObj.get(DCAE_STATUS_FIELD);\r
\r
/**\r
* Returns status URL for createNewDeployment operation.\r
- *\r
* @param deploymentId\r
* The deployment ID\r
* @param serviceTypeId\r
String nodeAttr) throws IOException, ParseException {\r
Date startTime = new Date();\r
try {\r
- String responseStr = dcaeHttpConnectionManager.doDcaeHttpQuery(url, requestMethod, payload, contentType);\r
+ String responseStr = dcaeHttpConnectionManager.doHttpRequest(url, requestMethod, payload, contentType, "DCAE", null, null);\r
JSONObject jsonObj = parseResponse(responseStr);\r
JSONObject linksObj = (JSONObject) jsonObj.get(node);\r
String statusUrl = (String) linksObj.get(nodeAttr);\r