Last active
August 29, 2015 14:07
-
-
Save jsloyer/f94c079255bafca6d543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private JSONArray cloudant; | |
private JSONObject cloudantInstance; | |
private JSONObject cloudantCredentials; | |
public CloudantClient() | |
{ | |
this.httpClient = null; | |
try { | |
String VCAP_SERVICES = System.getenv("VCAP_SERVICES"); | |
JSONObject vcap; | |
vcap = (JSONObject) JSONObject.parse(VCAP_SERVICES); | |
cloudant = (JSONArray) vcap.get("cloudantNoSQLDB"); | |
cloudantInstance = (JSONObject) cloudant.get(0); | |
cloudantCredentials = (JSONObject) cloudantInstance.get("credentials"); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
this.port = Config.CLOUDANT_PORT; | |
this.host = (String) cloudantCredentials.get("host"); | |
this.username = (String) cloudantCredentials.get("username"); | |
this.password = (String) cloudantCredentials.get("password"); | |
this.name = Config.CLOUDANT_NAME; | |
this.dbc = this.createDBConnector(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment