public final class CredentialUtils
extends java.lang.Object
| Modifier and Type | Class and Description | 
|---|---|
| static class  | CredentialUtils.ServiceCredentialsA util class to easily store service credentials. | 
| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | PLAN_EXPERIMENTALThe Constant PLAN_EXPERIMENTAL. | 
| static java.lang.String | PLAN_FREEThe Constant PLAN_FREE. | 
| static java.lang.String | PLAN_STANDARDThe Constant PLAN_STANDARD. | 
| Modifier and Type | Method and Description | 
|---|---|
| static java.lang.String | getAPIKey(java.lang.String serviceName)Returns the apiKey from the VCAP_SERVICES or null if doesn't exists. | 
| static java.lang.String | getAPIKey(java.lang.String serviceName,
         java.lang.String plan)Returns the apiKey from the VCAP_SERVICES or null if doesn't exists. | 
| static java.lang.String | getAPIUrl(java.lang.String serviceName)Gets the API url. | 
| static java.lang.String | getAPIUrl(java.lang.String serviceName,
         java.lang.String plan)Returns the API URL from the VCAP_SERVICES, JDNI, or null if doesn't exists. | 
| static java.lang.String | getAPIUrlTest(java.lang.String serviceName)Method for testing the getAPIUrl method that bypasses the VCAP
 services to ensure retrieval from JDNI. | 
| static CredentialUtils.ServiceCredentials | getUserNameAndPassword(java.lang.String serviceName)Returns the username and password as defined in the VCAP_SERVICES or null if they do not exist or are not
 accessible. | 
| static CredentialUtils.ServiceCredentials | getUserNameAndPassword(java.lang.String serviceName,
                      java.lang.String plan)Returns the username and password as defined in the VCAP_SERVICES or null if they do not exist or are not
 accessible. | 
| static void | setContext(java.util.Hashtable<java.lang.String,java.lang.String> env)Sets the context variable for JDNI. | 
| static void | setServices(java.lang.String services)Sets the VCAP_SERVICES variable. | 
public static final java.lang.String PLAN_EXPERIMENTAL
public static final java.lang.String PLAN_FREE
public static final java.lang.String PLAN_STANDARD
public static java.lang.String getAPIKey(java.lang.String serviceName)
serviceName - the service namepublic static java.lang.String getAPIKey(java.lang.String serviceName,
                         java.lang.String plan)
serviceName - the service nameplan - the service plan: standard, free or experimentalpublic static CredentialUtils.ServiceCredentials getUserNameAndPassword(java.lang.String serviceName)
getUserNameAndPassword(String, String). Invoking this method is
 identical to calling getUserNameAndPassword(serviceName, null);serviceName - the name of the service whose credentials are soughtpublic static CredentialUtils.ServiceCredentials getUserNameAndPassword(java.lang.String serviceName, java.lang.String plan)
serviceName - the name of the service whose credentials are soughtplan - the plan namepublic static java.lang.String getAPIUrl(java.lang.String serviceName)
serviceName - the service namepublic static java.lang.String getAPIUrl(java.lang.String serviceName,
                         java.lang.String plan)
serviceName - the service nameplan - the service plan: standard, free or experimentalpublic static void setServices(java.lang.String services)
services - the VCAP_SERVICESpublic static void setContext(java.util.Hashtable<java.lang.String,java.lang.String> env)
env - Configuration options for the contextpublic static java.lang.String getAPIUrlTest(java.lang.String serviceName)
serviceName - the service name