BiodbConnBase: Base class of 'BiodbConn' for encapsulating all needed...

BiodbConnBaseR Documentation

Base class of BiodbConn for encapsulating all needed information for database access.

Description

Base class of BiodbConn for encapsulating all needed information for database access.

Base class of BiodbConn for encapsulating all needed information for database access.

Details

This is the base class for BiodbConn and BiodbDbInfo. When defining a new connector class, your class must not inherit from BiodbBaseConn but at least from BiodbConn (or BiodbRemoteConn or any subclass of BiodbConn). Its main purpose is to store property values. Those values are initialized from YAML files. The default definition file is located inside the package in "inst/definitions.yml" and is loaded at Biodb startup. However you can define your own files and load them using the BiodbMain::loadDefinitions() method.

Arguments to the contructor are:

other: Another object inheriting from BiodbBaseConn, and from which property values will be copied.

db.class: The class of the database ("mass.csv.file", "comp.csv.file", ...).

properties: Some properties to set at initialization.

Methods

Public methods


Method new()

New instance initializer. Connector objects must not be created directly. Instead, you create new connector instances through the BiodbFactory instance.

Usage
BiodbConnBase$new(other = NULL, db.class = NULL, properties = NULL, cfg = NULL)
Arguments
other

Another BiodbConnBase instance as a model from which to copy property values.

db.class

The class of the connector (i.e.: "mass.csv.file").

properties

Some new values for the properties.

cfg

The BiodbConfig instance from which will be taken some property values.

Returns

Nothing.


Method print()

Prints a description of this connector.

Usage
BiodbConnBase$print()
Returns

Nothing.


Method hasProp()

Tests if this connector has a property.

Usage
BiodbConnBase$hasProp(name)
Arguments
name

The name of the property to check.

Returns

Returns true if the property name exists.


Method getPropSlots()

Gets the slot fields of a property.

Usage
BiodbConnBase$getPropSlots(name)
Arguments
name

The name of a property.

Returns

Returns a character vector containing all slot names defined.


Method hasPropSlot()

Tests if a slot property has a specific slot.

Usage
BiodbConnBase$hasPropSlot(name, slot)
Arguments
name

The name of a property.

slot

The slot name to check.

Returns

Returns TRUE if the property name exists and has the slot slot defined, and FALSE otherwise."


Method propExists()

Checks if property exists.

Usage
BiodbConnBase$propExists(name)
Arguments
name

The name of a property.

Returns

Returns TRUE if the property name exists, and FALSE otherwise.


Method isSlotProp()

Tests if a property is a slot property.

Usage
BiodbConnBase$isSlotProp(name)
Arguments
name

The name of a property.

Returns

Returns TRUE if the property is a slot propert, FALSE otherwise.


Method getPropValSlot()

Retrieve the value of a slot of a property.

Usage
BiodbConnBase$getPropValSlot(name, slot, hook = TRUE)
Arguments
name

The name of a property.

slot

The slot name inside the property.

hook

If set to TRUE, enables the calls to hook methods associated with the property. Otherwise, all calls to hook methods are disabled.

Returns

The value of the slot slot of the property name.


Method updatePropertiesDefinition()

Update the definition of properties.

Usage
BiodbConnBase$updatePropertiesDefinition(def)
Arguments
def

A named list of property definitions. The names of the list must be the property names.

Returns

Nothing.


Method getEntryFileExt()

Returns the entry file extension used by this connector.

Usage
BiodbConnBase$getEntryFileExt()
Returns

A character value containing the file extension.


Method getDbClass()

Gets the Biodb name of the database associated with this connector.

Usage
BiodbConnBase$getDbClass()
Returns

A character value containing the Biodb database name.


Method getConnClassName()

Gets the name of the associated connector OOP class.

Usage
BiodbConnBase$getConnClassName()
Returns

Returns the connector OOP class name.


Method getConnClass()

Gets the associated connector OOP class.

Usage
BiodbConnBase$getConnClass()
Returns

Returns the connector OOP class.


Method getEntryClassName()

Gets the name of the associated entry class.

Usage
BiodbConnBase$getEntryClassName()
Returns

Returns the name of the associated entry class.


Method getEntryClass()

Gets the associated entry class.

Usage
BiodbConnBase$getEntryClass()
Returns

Returns the associated entry class.


Method getEntryIdField()

Gets the name of the corresponding database ID field in entries.

Usage
BiodbConnBase$getEntryIdField()
Returns

Returns the name of the database ID field.


Method getPropertyValue()

Gets a property value.

Usage
BiodbConnBase$getPropertyValue(name, hook = TRUE)
Arguments
name

The name of the property.

hook

If set to TRUE, enables the calls to hook methods associated with the property. Otherwise, all calls to hook methods are disabled.

Returns

The value of the property.


Method setPropertyValue()

Sets the value of a property.

Usage
BiodbConnBase$setPropertyValue(name, value)
Arguments
name

The name of the property.

value

The new value to set the property to.

Returns

Nothing.


Method setPropValSlot()

Set the value of the slot of a property.

Usage
BiodbConnBase$setPropValSlot(name, slot, value, hook = TRUE)
Arguments
name

The name of the property.

slot

The name of the property's slot.

value

The new value to set the property's slot to.

hook

If set to TRUE, enables the calls to hook methods associated with the property. Otherwise, all calls to hook methods are disabled.

Returns

Nothing.


Method getBaseUrl()

Returns the base URL.

Usage
BiodbConnBase$getBaseUrl()
Returns

THe baae URL.


Method setBaseUrl()

Sets the base URL.

Usage
BiodbConnBase$setBaseUrl(url)
Arguments
url

A URL as a character value.

Returns

Nothing.


Method getWsUrl()

Returns the web sevices URL.

Usage
BiodbConnBase$getWsUrl()

Method setWsUrl()

Sets the web sevices URL.

Usage
BiodbConnBase$setWsUrl(ws.url)
Arguments
ws.url

A URL as a character value.

Returns

Nothing.


Method getToken()

Returns the access token.

Usage
BiodbConnBase$getToken()

Method setToken()

Sets the access token.

Usage
BiodbConnBase$setToken(token)
Arguments
token

The token to use to access the database, as a character value.

Returns

Nothing.


Method getName()

Returns the full database name.

Usage
BiodbConnBase$getName()

Method getEntryContentType()

Returns the entry content type.

Usage
BiodbConnBase$getEntryContentType()

Method getSchedulerNParam()

Returns the N parameter for the scheduler.

Usage
BiodbConnBase$getSchedulerNParam()

Method setSchedulerNParam()

Sets the N parameter for the scheduler.

Usage
BiodbConnBase$setSchedulerNParam(n)
Arguments
n

The N parameter as a whole number.

Returns

Nothing.


Method getSchedulerTParam()

Returns the T parameter for the scheduler.

Usage
BiodbConnBase$getSchedulerTParam()

Method setSchedulerTParam()

Sets the T parameter for the scheduler.

Usage
BiodbConnBase$setSchedulerTParam(t)
Arguments
t

The T parameter as a whole number.

Returns

Nothing.


Method getUrls()

Returns the URLs.

Usage
BiodbConnBase$getUrls()

Method getUrl()

Returns a URL.

Usage
BiodbConnBase$getUrl(name)
Arguments
name

The name of the URL to retrieve.

Returns

The URL as a character value.


Method setUrl()

Sets a URL.

Usage
BiodbConnBase$setUrl(name, url)
Arguments
name

The name of the URL to set.

url

The URL value.

Returns

Nothing.


Method getXmlNs()

Returns the XML namespace.

Usage
BiodbConnBase$getXmlNs()

Method clone()

The objects of this class are cloneable with this method.

Usage
BiodbConnBase$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Sub-classes BiodbDbInfo and BiodbConn.

Examples

# Create an instance with default settings:
mybiodb <- biodb::newInst()

# Accessing BiodbConnBase methods when using a BiodbDbInfo object
dbinf <- mybiodb$getDbsInfo()$get('comp.csv.file')

# Test if a property exists
dbinf$hasProp('name')

# Get a property value
dbinf$getPropertyValue('name')

# Get a property value slot
dbinf$getPropValSlot('urls', 'base.url')

# Terminate instance.
mybiodb$terminate()


pkrog/biodb documentation built on Nov. 29, 2022, 4:24 a.m.