BluemixContext (Java)
Used to help in the development of XPages applications running on Bluemix. This class provides properties to retrieve information from the XPages runtime and connection information from any bound XPages NoSQL Database service.
It does this by parsing the Bluemix VCAP_SERVICES
environment
variable provided by the bound service. Use the Bluemix VCAP_SERVICES
environment variable to retrieve the information and credentials you
need to access the XPages NoSQL Database service with various Bluemix
runtimes.
Syntax
public class BluemixContext
extends Base
Using BluemixContext to retrieve information
As mentioned, the BluemixContext class was developed to provide properties to retrieve information from the Bluemix XPages runtime and as well as connection information from any bound XPages NoSQL Database service. You can also retrieve information about hybrid applications (applications where the application data resides outside of Bluemix).
This
class/object is available in both SSJS (Server-side JavaScript) and
Java. The global BluemixContext
object already exists
for obtaining information. It can be used immediately and does not
have to be created in your code. Available properties for this class
include the following:
public Vector atHybridDbName(dbPath)
- For use with hybrid applications. Returns a Vector value that contains the address of your private Domino server as the first element and the path to your database in the second element. This is the equivalent of using @DbName in an on-premises application, or using the atDbName method from the Bluemix Context class for an XPages application on Bluemix bound to the experimental XPages NoSQL DB service.
public string findHybridDatabaseName(dbPath)
- For use with hybrid applications. Returns a String value that can be passed to the databaseName property of XPages data sources. This value will be properly formatted to point a data source to a data NSF on the private Domino server of your hybrid environment.
public String getAPP_HOME_URL()
- Returns the Home URL for the application.
public String getAPP_INCLUDE_XPAGES_TOOLBOX()
- Returns "true" if the Bluemix application includes the XPages Toolbox.
public String getAPP_JVM_HEAPSIZE()
- Returns the heapsize of the JVM running this application.
public String getAPP_PRELOAD_DB()
- Returns the preload db environment variable.
public String getAPP_VERBOSE_STAGING()
- Returns the verbose staging environment variable.
public String getBuildPackVersion()
- Returns the XPages buildpack version number.
public DataService getDataService()
- Returns DataService representing a bound XPages NoSQL Database service.
public DataService getDataServiceByName(String)
- Returns a named DataService representing a bound XPages NoSQL Database service.
public boolean IsDataServiceByNameExists(String)
- Returns true if this application is bound to a named XPages NoSQL Database Service.
public boolean IsDataServiceExists()
- Returns true if this application is bound to any XPages NoSQL Database Service.
public boolean isHybridApplication()
- For use with hybrid applications. Returns true if this application has been configured as a hybrid Bluemix application.
public boolean IsRunningOnBluemix()
- Returns true if this XPages application is running in the Bluemix environment.
The following "get" properties are also available to retrieve specific Cloud Foundry environment variables (in uppercase) available to your application.
- getHOME()
- getMEMORY_LIMIT()
- getPORT()
- getPWD()
- getTMPDIR()
- getUSER()
- getVCAP_APP_HOST()
- getVCAP_APP_PORT()
- getVCAP_APPLICATION()
- getVCAP_SERVICES()
Retrieving information about the DataService class
The
BluemixContext class getDataService
and getDataServiceByName
properties
return the DataService
component. This class provides
properties to retrieve information about the bound XPages NoSQL Database
Service from the VCAP_SERVICES environment variables outlined previously.
The available properties include the following:
- public String findDatabaseName()
- public Vector atDbName(String)
- public String getAppPath()
- public String getCredentialsValue(String)
- public String getHost()
- public String getLabel()
- public String getPlan()
- public String getRootDir()
- public String getServerName()
- public String getUserName()
- public String getValue(String)