com.hcl.domino.db Server API
This page describes Server API functions in detail. To navigate between sections, use the table of contents on the right.
Server class
createDatabase
Creates a database.
- If there is a names list in the "Create databases & templates" field on the Security tab, Server Access section of the Server document, a user must be included in the list to be able to create a database.
Parameters
options
accessToken
{Object
} Optional - An optional access token. See OptionalAccessToken for details.databasePath
{string
} REQUIRED - Database name with .nsf extension and path relative to the Domino data directory, for example, TestDatabase.nsf.databaseTitle
{string
} REQUIRED - Database title.templatePath
{string
} Optional - Database template path.
Return Value
{
ListenableFuture
<DBOperationResponse
>} A ListenableFuture resolved with DBOperationResponse.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
DBOperationResponse response = server.createDatabase("TestDatabase.nsf", "Test Database Title").get();
deleteDatabase
To delete a database, a user must have Manager access in the database ACL and access to the server.
Parameters
options
accessToken
{Object
} Optional - An optional access token. See OptionalAccessToken for details.databasePath
{string
} REQUIRED - Database name with .nsf extension and path relative to the Domino data directory, for example, TestDatabase.nsf.
Return Value
{
ListenableFuture
<DBOperationResponse
>} A ListenableFuture resolved with DBOperationResponse.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
DBOperationResponse response = server.deleteDatabase("TestDatabase.nsf").get();
getFileSystemList
This function gets a list of database files and directories in a specified directory. The application must have access to the server. The list contains the following types of entries:
database file (.nsf)
template file (.ntf)
mailbox file (.box)
database directory
Notes:
- This API supports listing of files from the Domino data directory or its subdirectories.
- The function will provide a list of files in the provided directory only, the user needs to call this function recursively the list files in its subdirectories.
- This API will honour the Directory ACL file (.ACL file), which allow access to files in the current directory to users IDs listed in '.ACL' file.
Parameters
dirPath
{string
} REQUIRED - The path to the database directory relative to the Domino data directory. Only path within the Domino data directory are allowed. For domino data directory provide empty string.accessToken
{string
} Optional - An optional access token. See Act-as-User for details.
Return Value
This function will return ListenableFeature of FileSystemListResponse
Example
Server server = new Server(HOST_NAME, PORT,
new File("c:\\certs\\ca.crt"),
new File("c:\\certs\\iamapp.crt"),
new File("c:\\certs\\iamapp.key"),
"Hcl@1234",
"Hcl@1234",
EXECUTOR_SERVICE);
FileSystemListResponse response = server.getFileSystemList(dbDirPath).get();
if (response.hasError()) {
System.out.println("Error: " + response.getErrorCode());
}
for (FileSystemEntryInfo dbEntry: response.getFileSystemList()) {
System.out.println("Database Name: " + dbEntry.getPath());
}
DBOperationResponse class
getErrorCode
Returns error code related to success/failure operations.
Return Value
ErrorCode
{int
} Returns error code in int.
getErrorInfo
Returns error message specific to error code.
Return Value
{
String
} Returns error message based on code.
Example
Server server = new Server('your.server.com', 3002,
new File("ca.crt"),
new File("user.crt"),
new File("user.key"),
"Key@1234", // key file passphrase
"ID@1234", // ID file password
EXECUTOR_SERVICE);
DBOperationResponse response = server.createDatabase("TestDatabase.nsf", "Test Database Title").get();
System.out.println(response.getErrorCode());
System.out.println(response.getErrorInfo());
FileSystemListResponse class
getFileSystemList
Gets the list of file system entries within the response.
Return Value
List<FileSystemEntryInfo>
Returns List of FileSystemEntryInfo objects.
getErrorCode
Returns error code related to success/failure operations.
Return Value
int
Returns error code in int.
hasError
This function check if the operation resulted in an error or not.
Return Value
boolean
Returns true if the response has a valid error code.
FileSystemEntryInfo class
getPath
Getter function for getting the path of File System Entry, relative to Domino data directory.
Return Value
String
Returns the path of File System entry.
getTitle
Getter function for getting the title of File System Entry, it will be empty for a database Directory entry.
Return Value
String
Returns title for the entry.
getType
Getter function for retrieving the type of File System Entry.
Return Value
FileSystemEntryType
Returns the type of File System Entry. It could be one of the following value:
Database
- Database file (.nsf)Template
- Template file (.ntf)Mailbox
- Mailbox file (.box)Directory
- Database directory
getCreatedDate
Getter function for getting creation date of File System Entry, it will be empty for the database directory.
Return Value
LocalDateTime
Returns created date.
getModifiedDate
Getter function for getting the last modified date of File System Entry, it will be empty for the database Directory entry.
Return Value
LocalDateTime
Returns Last modified date.
getSize
Getter function for getting the size of File System Entry, it will be 0 for the database Directory entry.
Return Value
int
Returns the size of File System Entry.