Jala 1.3

## Class jala.db.Server

    Object
       |
       +--jala.db.Server

class jala.db.Server

Instances of this class represent a H2 database listener that allows multiple databases to be accessed via tcp.
Important: You need the h2.jar in directory "lib/ext" of your helma installation for this library to work, which you can get at http://www.h2database.com/.
Defined in Database.js

Constructor Summary
`jala.db.Server (<helma.File> baseDir, <Number> port)` Returns a new Server instance.

Method Summary
`Boolean` | `createOnDemand(<Boolean> bool)` If called with boolean true as argument, this server creates databases on-the-fly, otherwise it only accepts connections to already existing databases.
`helma.Database` | `getConnection(<String> name, <String> username, <String> password, <Object> props)` Returns a connection to a database within this server.
`helma.File` | `getDirectory()` Returns the directory used by this server instance
`Number` | `getPort()` Returns the port this server listens on
`helma.util.ResourceProperties` | `getProperties(<String> name, <String> username, <String> password, <Object> props)` Returns a properties object containing the connection properties of the database with the given name.
`String` | `getUrl(<String> name, <Object> props)` Returns the JDBC Url to use for connections to a given database.
`Boolean` | `isPublic(<Boolean> bool)` If called with boolean true as argument, this server accepts connections from outside localhost.
`Boolean` | `isRunning()` Returns true if the database server is running.
`Boolean` | `start()` Starts the database server.
`Boolean` | `stop()` Stops the database server.
`Boolean` | `useSsl(<Boolean> bool)` Toggles the use of Ssl encryption within this server.

Constructor Detail

### jala.db.Server

    jala.db.Server(<helma.File> baseDir, <Number> port)

Returns a new Server instance.

Parameters:

`baseDir` - The directory where the database files are located or should be stored

`port` - The port to listen on (defaults to 9001)

`createOnDemand` - If true this server will create non-existing databases on-the-fly, if false it only accepts connections to already existing databases in the given base directory

`makePublic` - If true this database is reachable from outside, if false it's only reachable from localhost

`useSsl` - If true SSL will be used to encrypt the connection

Returns:

A newly created Server instance

Method Detail

### createOnDemand

    Boolean createOnDemand(<Boolean> bool)

If called with boolean true as argument, this server creates databases on-the-fly, otherwise it only accepts connections to already existing databases. This should be set before starting the server.

Parameters:

`bool` - If true this server creates non-existing databases on demand, if false it only allows connections to existing databases. If no argument is given, this method returns the current setting.

Returns:

The current setting if no argument is given, or void

### getConnection

    helma.Database getConnection(<String> name, <String> username, <String> password, <Object> props)

Returns a connection to a database within this server.

Parameters:

`name` - The name of the database running within this server

`username` - Optional username to use for this connection

`password` - Optional password to use for this connection

`props` - An optional parameter object containing connection properties to add to the connection Url.

Returns:

A connection to the specified database

### getDirectory

    helma.File getDirectory()

Returns the directory used by this server instance

Returns:

The directory where the databases used by this server are located in

### getPort

    Number getPort()

Returns the port this server listens on

Returns:

The port this server listens on

### getProperties

    helma.util.ResourceProperties getProperties(<String> name, <String> username, <String> password, <Object> props)

Returns a properties object containing the connection properties of the database with the given name.

Parameters:

`name` - The name of the database

`username` - Optional username to use for this connection

`password` - Optional password to use for this connection

`props` - An optional parameter object containing connection properties to add to the connection Url.

Returns:

A properties object containing the connection properties

### getUrl

    String getUrl(<String> name, <Object> props)

Returns the JDBC Url to use for connections to a given database.

Parameters:

`name` - An optional name of a database running

`props` - Optional connection properties to add

Returns:

The JDBC Url to use for connecting to a database within this sever

### isPublic

    Boolean isPublic(<Boolean> bool)

If called with boolean true as argument, this server accepts connections from outside localhost. This should be set before starting the server.

Parameters:

`bool` - If true this server accepts connections from outside localhost. If no argument is given, this method returns the current setting.

Returns:

The current setting if no argument is given, or void

### isRunning

    Boolean isRunning()

Returns true if the database server is running.

Returns:

True if the database server is running

### start

    Boolean start()

Starts the database server.

Returns:

True in case the server started successfully, false otherwise

### stop

    Boolean stop()

Stops the database server.

Returns:

True if stopping the server was successful, false otherwise

### useSsl

    Boolean useSsl(<Boolean> bool)

Toggles the use of Ssl encryption within this server. This should be set before starting the server.

Parameters:

`bool` - If true SSL encryption will be used, false otherwise. If no argument is given, this method returns the current setting.

Returns:

The current setting if no argument is given, or void

Jala 1.3

Documentation generated by JSDoc on Tue Jan 8 15:45:31 2008