Child pages
  • Maintenance Mode

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Function

createNewTable isInMaintenanceMode

Description Creates in this server a new table with the specified name.
Syntax
createNewTable(tableName)
Parameters
tableName -

Returns true if the server is in maintenance mode, false otherwise.

Example

No Format
nopaneltrue
var server = if (plugins.maintenance.getServerisInMaintenanceMode("example_data");
if (server)
{
	var table = server.createNewTable("new_table");
	if (table) application.output("New table createdapplication.output("Server is in maintenance mode.");
	else
	application.output("NewServer tableis not in createdmaintenance mode.");
}

Function

getTable setMaintenanceMode

Description

Returns a JSTable instance corresponding the the table with the specified name from this server Puts the server into/out of maintenance mode, depending on the boolean parameter that is specified (if the parameter is true, then the server will be put into maintenance mode; if the parameter is false, then the server will be put out of maintenance mode).

Syntax
getTablesetMaintenanceMode(tableNamemaintenanceMode)

Parameters
tableName maintenanceMode -

Example

No Format
nopaneltrue
var server = plugins.maintenance.setMaintenanceMode(!plugins.maintenance.getServer("example_data"isInMaintenanceMode());
if (server) {
	var table = server.getTable("employees");
	if (table) {
		var colNames = table.getColumnNames()
		

Function

getConnectedClients

Description

Returns an array of IClientInformation elements describing the clients connected to the server.

Example

No Format
nopaneltrue

var clients = plugins.maintenance.getConnectedClients();
application.output("TableThere hasare " + colNamesclients.length + " columnsconnected clients.");
		for (var i = 0; i < i<colNamesclients.length; i++)
			application.output("ColumnClient has clientId '" + clients[i].getClientId() + ": ' and has connected from host '" + colNamesclients[i].getHostAddress(); 	}
}+ "'.");

Function

synchronizeWithDB sendMessageToAllClients

Description

Synchronizes a JSTable instance with the database. If columns were added to or removed from the JSTable instance, all these changes will now be persisted to the database Sends a message to all connected clients.

Syntax
synchronizeWithDBsendMessageToAllClients(tablemessage)

Parameters
table message -

Example

No Format
nopaneltrue

var
server = plugins.maintenance.getServersendMessageToAllClients("example_dataHello, all clients!");
if (server) {
	var table = server.getTable("new_table");
	if (table) {
		table.createNewColumn("new_column", DM_COLUMNTYPE.TEXT, 100);
var result = server.synchronizeWithDB(table);
		if (result)
			application.output("Table successfully synchronized.");
		else
			application.output("Table not synchronized.");
	}
}

Function

dropTable

Description

Drops the table with the specified name from this server.
Syntax
dropTable(tableName)
Parameters
tableName


Function

sendMessageToClient

Description

Sends a message to a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method.

Syntax
sendMessageToClient(clientId, message)

Parameters
clientId -
message -

Example

No Format
nopaneltrue

var clients = plugins.maintenance.getConnectedClients();
for (var i=0; i<clients.length; i++)
	plugins.maintenance.sendMessageToClient(clients[i].getClientId(), "Hello, client " + clients[i].getClientId() + "!");

Function

shutDownAllClients

Description

Shuts down all connected clients.

Example

No Format
nopaneltrue

plugins.maintenance.shutDownAllClients();

Function

shutDownClient

Description

Shuts down a specific client, identified by its clientId. The clientIds are retrieved by calling the getConnectedClients method.

Syntax
shutDownClient(clientId)

Parameters
clientId -

Example

No Format
nopaneltrue
var serverclients = plugins.maintenance.getServergetConnectedClients("example_data");
iffor (server) {
	var result i=0; server.dropTable("new_table");
	if (result)
		application.output("Table dropped.");
	else
	application.output("Table not dropped.");
}i<clients.length; i++)
	plugins.maintenance.shutDownClient(clients[i].getClientId());

Function

getTableNames getServer

Description

Returns an array with the names of all tables in this server.

Retrieves an instance of JSServer corresponding to the server with the name specified through the "serverName" argument. If the optional argument "mustBeEnabled" is set to true, then the JSServer instance is returned only if the server is active. Similarly, if the "mustBeValid" optional argument is set to true, then the JSServer instance is returned only if the server is valid. If the specified server is not found, or if it does not meet the requirements imposed by the optional arguments, then null is returned. By default both optional arguments have the value false.

Syntax
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b2e6fc25-d629-4736-841b-b651083ad342"><ac:plain-text-body><![CDATA[getServer(serverName, [mustBeEnabled], [mustBeValid])]]></ac:plain-text-body></ac:structured-macro>

Parameters
serverName -
mustBeEnabled -
mustBeValid -

Example

No Format
nopaneltrue
var server = plugins.maintenance.getServer("example_data");
if (server) {
	var tableNames = server.getTableNames();
	application.output("There are " + tableNames.length + " tables.");
	for (var i=0; i<tableNames.length; i++)
		application.output("Table " + i + ": " + tableNames[i]);
	}
else {
	plugins.dialogs.showInfoDialog("Attention","Server 'example_data' cannot be found.","OK");
}

Function

getServerNames

Description

Retrieves a list with the names of all available database servers. The returned list will contain only enabled servers if the "mustBeEnabled" optional argument is set to true. The list will contain only valid servers if the "mustBeValid" argument is set to true. If the "sort" optional argument is set to true, then the list will be sorted alphabetically. If the "includeDuplicates" optional argument is set to false, then duplicate servers will appear only once in the list. By default, the "mustBeEnabled" and the "mustBeValid" arguments have the value false, while the "sort" and "includeDuplicates" arguments have the value true.

Syntax
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="62410893-4124-435b-bdf5-0642bac90083"><ac:plain-text-body><![CDATA[getServerNames([mustBeEnabled], [mustBeValid], [sort], [includeDuplicates])]]></ac:plain-text-body></ac:structured-macro>

Parameters
mustBeEnabled -
mustBeValid -
sort -
includeDuplicates -

Example

No Format
nopaneltrue

var serverNames = plugins.maintenance.getServerNames();
application.output("There are " + serverNames.length + " servers.");
for (var i=0; i<serverNames.length; i++)
	application.output("Server " + i + ": " + serverNames[i]);