DataService (Java)

Used to help in the development of XPages applications running on Bluemix. The DataService class is based on the Java class com.ibm.xsp.bluemix.util.context.BluemixContext.DataService. This class provides methods to retrieve information about the bound XPages NoSQL Database Service from the VCAP_SERVICES environment.

Retrieving information about the DataService class

The BluemixContext class getDataService and getDataServiceByName methods return the DataService class. This class provides methods to retrieve information about the bound XPages NoSQL Database Service from the VCAP_SERVICES environment variables. The available methods include the following:

public String findDatabaseName()
Returns the database name associated with the bound service being queried.
public Vector atDbName(String)
This property is intended to be used as a substitute for the @DbName() at-function. @DbName() and atDbName() are commonly used with the @DbLookup and @DbColumn @ functions.
public String getAppPath()
Returns the application location path of the database associated with the bound service.
public String getCredentialsValue(String)
Returns the credential values of the database associated with the bound service.
public String getHost()
Returns the name of the host associated with the application using the bound service.
public String getLabel()
Returns the label that was assigned to the application associated with the bound service.
public String getPlan()
Returns the Bluemix service plan assigned to the application associated with the bound service.
public String getRootDir()
Returns the root directory information related to the application associated with the bound service.
public String getServerName()
Returns the hosting server name information related to the application associated with the bound service.
public String getUserName()
Returns the user name information related to the application associated with the bound service.
public String getValue(String)
Can be used as an alternative to return the same values as getName(), getLabel(), and getPlan(). The method looks directly at the values in the VCAP_SERVICES environment variable.

For detailed descriptions of the VCAP_SERVICES environment variables, refer to the Bluemix documentation on environment variables for more information.