import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
+
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound;
import org.openecomp.mso.openstack.utils.MsoKeystoneUtils;
import org.openecomp.mso.openstack.utils.MsoNeutronUtils;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+
/**
* This class returns a cloud Config instances
*/
private static final long serialVersionUID = 2956662716453261085L;
- private CloudConfig cloudConfigCache = new CloudConfig();
+ private static CloudConfig cloudConfigCache = new CloudConfig();
protected static String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
- private int refreshTimer;
+ private static int refreshTimer;
private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock ();
prefixMsoPropertiesPath = "";
}
}
-
+
public void initializeCloudConfig (String filePath, int refreshTimer) throws MsoCloudIdentityNotFound {
rwl.writeLock ().lock ();
try {
public CloudConfig getCloudConfig () {
rwl.readLock ().lock ();
try {
- if (cloudConfigCache.isValidCloudConfig()) {
- return cloudConfigCache.clone ();
- } else {
- return new CloudConfig();
+ if (!cloudConfigCache.isValidCloudConfig()) {
+ // Not ideal, but better than returning an invalid object
+ throw new IllegalStateException("No valid CloudConfig is loaded");
}
+ return cloudConfigCache.clone ();
} finally {
rwl.readLock ().unlock ();
}
/**
* This method is not intended to be called, it's used to refresh the config
* automatically
- *
- * @return true if Properties have been reloaded, false otherwise
*/
@Schedule(minute = "*/1", hour = "*", persistent = false)
public void reloadCloudConfig () {