summaryrefslogtreecommitdiffstats
path: root/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java')
-rw-r--r--appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java b/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java
index c465b9b10..6e6ab036b 100644
--- a/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java
+++ b/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/ConfigurationHelper.java
@@ -30,12 +30,17 @@ import org.openecomp.appc.Constants;
import org.openecomp.appc.configuration.Configuration;
import org.openecomp.appc.configuration.ConfigurationFactory;
+import java.util.concurrent.TimeUnit;
+
/**
* Utility class provides general configuration helps
*/
public class ConfigurationHelper {
final static String PROP_KEY_APPC_NAME = Constants.PROPERTY_APPLICATION_NAME;
final static String PROP_KEY_METRIC_STATE = "metric.enabled";
+ private final String OAM_OPERATION_TIMEOUT_SECOND = "appc.OAM.api.timeout";
+ /** Default operation timeout set to 1 minute */
+ private final int DEFAULT_OAM_OPERATION_TIMEOUT = 60;
private final EELFLogger logger;
private Configuration configuration = ConfigurationFactory.getConfiguration();
@@ -57,7 +62,7 @@ public class ConfigurationHelper {
}
/**
- * Read property value of a specified proeprty key
+ * Read property value of a specified property key
*
* @param propertyKey string of the property key
* @return String[] of the property values associated with the propertyKey
@@ -77,4 +82,23 @@ public class ConfigurationHelper {
}
return new String[]{propertyValue};
}
+
+
+
+
+
+ /**
+ * This method returns timeout in milliseconds. The source is chosen in the following order:
+ * The overrideTimeoutSeconds argument
+ * or {@link #OAM_OPERATION_TIMEOUT_SECOND} found in the configuration file
+ * or the {@link #DEFAULT_OAM_OPERATION_TIMEOUT}
+ * @param overrideTimeoutSeconds or null to us the other sources
+ * @return timeout in milliseconds
+ */
+ public long getOAMOperationTimeoutValue(Integer overrideTimeoutSeconds) {
+ return overrideTimeoutSeconds == null ?
+ getConfig().getIntegerProperty(OAM_OPERATION_TIMEOUT_SECOND, DEFAULT_OAM_OPERATION_TIMEOUT) * 1000
+ :
+ TimeUnit.MILLISECONDS.toMillis(overrideTimeoutSeconds);
+ }
}