Schema Class

From JRapid

Jump to: navigation, search

Contents

Introduction

The Schema class holds information for each schema or tenant. JRapid applications are built with the concept of multitenancy in mind.

A Schema is defined by a group of properties present in the jrapid.properties configuration files.

Methods

public String getProperty(String propertyName)
Returns specified property for this schema.
public String getNonTenantProperty(String propertyName)
Returns specified general property for all schemas.
public File getRepository()
Returns a reference to the application's files repository corresponding to the current logged in user.

Example

The following jrapid.properties shows how more than one schema can be defined for the same web app.

tenant1.connection.url=jdbc:mysql://db1.jrapid.com:3306/tenant1?autoReconnect=true
tenant1.connection.username=tenant1
tenant1.connection.password=tenant1_password
tenant1.repository=/repository/tenant1/

tenant2.connection.url=jdbc:mysql://db1.jrapid.com:3306/tenant2?autoReconnect=true
tenant2.connection.username=tenant2
tenant2.connection.password=tenant2_password
tenant2.repository=/repository/tenant2/


Get the application's files repository corresponding to the current logged in user:

File repo = Session.getMySession().getSchema().getRepository();

See also

Personal tools