To create a persistence instance, use the following rhino-console command or related MBean operation.

Console command: createpersistenceinstance

Command

createpersistenceinstance <name> <type> [-ds <datasource-class-name>]
[-set-property (<property-name> <property-type> <property-value)*]
  Description
    Create a persistence instance configuration.  The type may be 'jdbc' or
    'cassandra'.  A datasource class name must be specified for 'jdbc'
    configurations.

Example

This example creates a new persistence instance with the following configuration properties:

  • Name: oracle

  • Type: jdbc

  • Datasource class name: oracle.jdbc.pool.OracleDataSource

  • JavaBean properties:

    • name: URL
      type: java.lang.String
      value: jdbc:oracle:thin:@oracle_host:1521:db

    • name: user
      type: java.lang.String
      value: ${MANAGEMENT_DATABASE_USER}

    • name: password
      type: java.lang.String
      value: ${MANAGEMENT_DATABASE_PASSWORD}

    • name: loginTimeout
      type: java.lang.Integer
      value: 30

$ ./rhino-console createpersistenceinstance oracle jdbc \
    -ds oracle.jdbc.pool.OracleDataSource \
    -set-property URL java.lang.String jdbc:oracle:thin:@oracle_host:1521:db \
    -set-property user java.lang.String '${MANAGEMENT_DATABASE_USER}' \
    -set-property password java.lang.String '${MANAGEMENT_DATABASE_PASSWORD}' \
    -set-property loginTimeout java.lang.Integer 30
Created persistence instance oracle

Configuration properties

A JDBC persistence instance has configuration properties defined by the JavaBean properties of the target datasource class. Reference must be made to the datasource documentation for the available properties.

A Cassandra persistence instance can be configured using the properties described below:

Property name Java type Description
contactPoints
java.lang.String

Comma-separated list of hostname and/or IP addresses of Cassandra cluster nodes

port
java.lang.Integer

Port to connect to on Cassandra hosts (default: 9042)

useSSL
java.lang.Boolean

Determines if SSL will be used for connections (default: false)

compression
java.lang.String

Binary protocol compression level (default: NONE)

user
java.lang.String

User name to connect as, required if Cassandra is using a password authenticator

password
java.lang.String

User password, required if Cassandra is using a password authenticator

keyspace
java.lang.String

Cassandra keyspace to use (default: none)

query.consistency
java.lang.String

Database query default consistency level (default: ONE)

query.serialConsistency
java.lang.String

Database query default serial consistency level (default: SERIAL)

query.fetchSize
java.lang.Integer

Database query default fetch size (default: 5000)

reconnectionPolicy
java.lang.String

Reconnection policy, either 'constant' or 'exponential' (default: exponential)

reconnectionPolicy.delay
java.lang.String

Reconnection policy delay in ms; either a single value for a 'constant' policy or two comma-separated values (min, max) for an 'exponential' policy

MBean operation: createPersistenceInstance

MBean

Rhino operation

public void createPersistenceInstance(String name, PersistenceInstanceType type, String dsClassName, ConfigProperty[] configProperties)
    throws NullPointerException, InvalidArgumentException,
      DuplicateNameException, ConfigurationException;
Previous page Next page
Rhino Version 2.7.0