summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/RestActivator.java2
-rw-r--r--appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/RestHealthcheckActivator.java12
-rw-r--r--appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java22
-rw-r--r--appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/main/java/org/onap/appc/adapter/ssh/Constants.java2
-rw-r--r--appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java16
5 files changed, 15 insertions, 39 deletions
diff --git a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/RestActivator.java b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/RestActivator.java
index 3e224b923..a1d2f40a8 100644
--- a/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/RestActivator.java
+++ b/appc-adapters/appc-rest-adapter/appc-rest-adapter-bundle/src/main/java/org/onap/appc/adapter/rest/RestActivator.java
@@ -101,6 +101,8 @@ public class RestActivator implements BundleActivator {
logger.info(Msg.COMPONENT_INITIALIZING, appName, "rest adapter");
adapter = new RestAdapterImpl();
if (registration == null) {
+ logger.info(Msg.REGISTERING_SERVICE, appName, adapter.getAdapterName(),RestAdapter.class.getSimpleName());
+
registration = context.registerService(RestAdapter.class, adapter, null);
}
diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/RestHealthcheckActivator.java b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/RestHealthcheckActivator.java
index acd9d013b..6dc413494 100644
--- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/RestHealthcheckActivator.java
+++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/RestHealthcheckActivator.java
@@ -36,17 +36,10 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
public class RestHealthcheckActivator implements BundleActivator {
-
/**
* The bundle registration
*/
private ServiceRegistration registration = null;
-
- /**
- * The reference to the actual implementation object that implements the services
- */
- private RestHealthcheckAdapter adapter;
-
private static final EELFLogger logger = EELFManager.getInstance().getLogger(RestHealthcheckActivator.class);
/**
@@ -72,14 +65,14 @@ public class RestHealthcheckActivator implements BundleActivator {
@Override
public void start(BundleContext context) throws Exception {
logger.info("Starting bundle " + getName());
+ /* The reference to the actual implementation object that implements the services */
+ RestHealthcheckAdapter adapter = new RestHealthcheckAdapterImpl();
- adapter = new RestHealthcheckAdapterImpl();
if (registration == null) {
registration = context.registerService(RestHealthcheckAdapter.class, adapter, null);
}
}
-
/**
* Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary to stop
* the bundle. In general, this method should undo the work that the BundleActivator.start method started. There
@@ -108,7 +101,6 @@ public class RestHealthcheckActivator implements BundleActivator {
}
}
-
public String getName() {
return "APPC Rest Healthcheck adapter";
}
diff --git a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java
index 9cf046fc6..f2d309996 100644
--- a/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java
+++ b/appc-adapters/appc-rest-healthcheck-adapter/appc-rest-healthcheck-adapter-bundle/src/main/java/org/onap/appc/adapter/restHealthcheck/impl/RestHealthcheckAdapterImpl.java
@@ -55,6 +55,7 @@ import java.io.IOException;
import java.net.InetAddress;
public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
+
/**
* The constant for the status code for a failed outcome
*/
@@ -74,14 +75,11 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
*/
public RestHealthcheckAdapterImpl() {
initialize();
-
}
-
@Override
public String getAdapterName() {
return configuration.getProperty(Constants.PROPERTY_ADAPTER_NAME);
}
-
public void checkHealth(Map<String, String> params, SvcLogicContext ctx) {
logger.info("VNF rest health check");
String uri=params.get("VNF.URI");
@@ -91,7 +89,7 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
rc.isAlive();
try(CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpGet httpGet = new HttpGet(tUrl);
- HttpResponse response =null ;
+ HttpResponse response ;
response = httpClient.execute(httpGet);
int responseCode=response.getStatusLine().getStatusCode();
HttpEntity entity = response.getEntity();
@@ -108,10 +106,6 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, ex.toString());
}
}
-
-
-
-
@SuppressWarnings("static-method")
private void doFailure(RequestContext rc, HttpStatus code, String message) {
SvcLogicContext svcLogic = rc.getSvcLogicContext();
@@ -119,7 +113,6 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
if (msg.contains("\n")) {
msg = msg.substring(msg.indexOf("\n"));
}
-
String status;
try {
status = Integer.toString(code.getStatusCode());
@@ -130,8 +123,6 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
svcLogic.setAttribute("healthcheck.result.code", "200");
svcLogic.setAttribute("healthcheck.result.message", status+" "+msg);
}
-
-
/**
* @param rc
* The request context that manages the state and recovery of the
@@ -143,27 +134,20 @@ public class RestHealthcheckAdapterImpl implements RestHealthcheckAdapter {
String msg = Integer.toString(code)+" "+message;
svcLogic.setAttribute("healthcheck.result.code", "200");
svcLogic.setAttribute("healthcheck.result.message", msg);
-
}
-
-
@SuppressWarnings("static-method")
private void doSuccess(RequestContext rc, int code, String message) {
SvcLogicContext svcLogic = rc.getSvcLogicContext();
String msg = Integer.toString(code)+" "+message;
svcLogic.setAttribute("healthcheck.result.code", "400");
svcLogic.setAttribute("healthcheck.result.message", msg);
-
}
-
-
/**
* initialize the provider adapter by building the context cache
*/
private void initialize() {
-
-
logger.info("init rest health check adapter!!!!!");
}
+
}
diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/main/java/org/onap/appc/adapter/ssh/Constants.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/main/java/org/onap/appc/adapter/ssh/Constants.java
index d3ed28a75..85a142245 100644
--- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/main/java/org/onap/appc/adapter/ssh/Constants.java
+++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-api/src/main/java/org/onap/appc/adapter/ssh/Constants.java
@@ -44,7 +44,7 @@ public class Constants {
public static final String REQUEST_ID_FIELD_NAME = "REQUEST_ID";
public static final String CREATION_DATE_FIELD_NAME = "CREATION_DATE";
public static final String LOG_FIELD_NAME = "LOG";
- public static final String ASDC_ARTIFACTS_TABLE_NAME = "ASDC_ARTIFACTS";
+ public static final String SDC_ARTIFACTS_TABLE_NAME = "ASDC_ARTIFACTS";
// input fields names
public static final String PAYLOAD = "payload";
diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java
index c35c58798..44cedc3bb 100644
--- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java
+++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-sshd/src/main/java/org/onap/appc/adapter/ssh/sshd/SshConnectionSshd.java
@@ -117,9 +117,9 @@ class SshConnectionSshd implements SshConnection {
@Override
public void connectWithRetry() {
- int retryCount = 0;
- int retryDelay = 0;
- int retriesLeft = 0;
+ int retryCount ;
+ int retryDelay ;
+ int retriesLeft;
retryCount = configuration.getIntegerProperty(Constants.CONNECTION_RETRY_COUNT,
Constants.DEFAULT_CONNECTION_RETRY_COUNT);
retryDelay = configuration.getIntegerProperty(Constants.CONNECTION_RETRY_DELAY,
@@ -139,9 +139,7 @@ class SshConnectionSshd implements SshConnection {
} else {
throw e;
}
- } catch (Exception e) {
- throw e;
- }
+ }
} while (retriesLeft > 0);
}
@@ -184,7 +182,7 @@ class SshConnectionSshd implements SshConnection {
client.setOut(out);
client.setErr(err);
OpenFuture openFuture = client.open();
- int exitStatus = 0;
+ int exitStatus;
try {
client.waitFor(ClientChannel.CLOSED, timeout);
openFuture.verify();
@@ -200,9 +198,9 @@ class SshConnectionSshd implements SshConnection {
return exitStatus;
} catch (RuntimeException e) {
throw e;
- } catch (Exception t) {
+ } catch (Exception e1) {
throw new SshException(
- "Error executing command [" + cmd + "] over SSH [" + username + "@" + host + ":" + port + "]", t);
+ "Error executing command [" + cmd + "] over SSH [" + username + "@" + host + ":" + port + "]", e1);
}
}