API for Administrative functions
This library contains the functions used by the Myna Administrator for tasks such as DataSource and Scheduled Task management
| Myna. Admin | API for Administrative functions |
| Properties and Functions | |
| dsValidation | a Myna.Validation object for validating data source configs |
| createLocalDatabase | create a local H2 databsae with the given name |
| dsExists | returns true if a datasource with the supplied name exists. |
| getDataSources | returns an array of DS structures currently configured |
| saveDataSource | updates a data source, |
| validateDataSource | validates a data source config |
| taskValidation | a Myna.Validation object for validating Scheduled task |
| getTasks | returns a JS object where the keys are task names and the values are task configs |
| saveTask | creates/updates a task, |
| removeTask | removes a task, |
a Myna.Validation object for validating data source configs
createLocalDatabase:function( name )
create a local H2 databsae with the given name
| name | name of datasource. Should only contain letters, number and (_) |
Returns Myna.ValidationResult
dsExists:function( name )
returns true if a datasource with the supplied name exists.
| name | name of a data source |
getDataSources:function getDataSources()
returns an array of DS structures currently configured
saveDataSource:function( config, isNew )
updates a data source,
| config | Config Object, see Config below |
| isNew | set to true for new datasources. This checks for the existence if a same-named data source and prevents overwrites |
| name | Name of data source. Must start with at least one letter and consist of only numbers, letters and the underbar(_) Must also be unique in regards to all other datasources |
| type | Vendor Type name as defined in Myna.Database.dbProperties |
| driver | Optional, default from dbProperties A valid driver className, e.g. “org.postgresql.Driver”. |
| desc | Optional, default null A description of this data source |
| location | Optional, default “network” either “file” or “network”. This switch determines which url template to use |
| file | Optional, default null File path to the database file. This should be an OS native path or a relative MynaPath such as “/WEB-INF/myna/local_databases/mydb”. Only makes sense for location=”file” |
| server | Optional, default null server name of DB. Only makes sense for location=”network” |
| port | Optional, default from dbProperties |
| db | Optional, default from dbProperties |
| username | Optional, null |
| password | Optional, null |
| url | Optional, default from dbProperties |
Only name, type, driver, url, username, and password are required for successful operation. The other fields are used to populate the DS UI, in MynaAdaminstrator and as a convenience for autogenerating url. See the examples below
//bare minimum, but requires knowledge of how the url string works
var result = Myna.Admin.saveDataSource({
name:"myna_log",
type:"postgresql",
url="jdbc:postgresql://localhost:5432/myna",
driver="org.postgresql.Driver",
username:"myna",
password:"nunyabidness"
})
//more verbose, but also more readable for GUI
//URL and driver are comuted from Myna.Database.dbProperties
var result = Myna.Admin.saveDataSource({
name:"myna_log",
type:"postgresql",
server:"localhost",
port:5432,
username:"myna",
password:"nunyabidness"
})
validateDataSource:function( config, isNew )
validates a data source config
| config | JS Object representing the data for a data source, see saveDataSource |
| isNew | Boolean. If true, Ds name will also be checked for uniqueness |
a Myna.Validation object for validating Scheduled task
getTasks:function getTasks()
returns a JS object where the keys are task names and the values are task configs
create a local H2 databsae with the given name
createLocalDatabase:function( name )
returns true if a datasource with the supplied name exists.
dsExists:function( name )
returns an array of DS structures currently configured
getDataSources:function getDataSources()
updates a data source,
saveDataSource:function( config, isNew )
validates a data source config
validateDataSource:function( config, isNew )
returns a JS object where the keys are task names and the values are task configs
getTasks:function getTasks()
creates/updates a task,
saveTask:function( config, isNew )