Class: Connector

Connector

Connects Alpaca to remote data stores.


new Connector(id, config)

Parameters:
Name Type Description
id String

Connector ID

config Object

Connector Config

Source:

Methods


buildAjaxConfig(uri, isJson)

Extension point. Set up default ajax configuration for URL retrieval.

Parameters:
Name Type Description
uri
isJson
Source:
Returns:
Type
Object

connect(onSuccess, onError)

Makes initial connections to data source.

Parameters:
Name Type Description
onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadAll(resources, onSuccess, onError)

Loads schema, form, view and data in a single call.

Parameters:
Name Type Description
resources Object

resources

onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadData(resource, resources, onSuccess, onError)

Loads JSON data.

Parameters:
Name Type Description
resource Object | String

Resource to be loaded

resources Object

Map of resources

onSuccess function

onSuccess callback

onError function

onError callback

Source:

loadDataSource(config, successCallback, errorCallback)

Loads data source (value/text) pairs from a remote source.
This default implementation allows for config to be a string identifying a URL.

Parameters:
Name Type Description
config
successCallback
errorCallback
Source:
Returns:
Type
*

loadJson(uri, onSuccess, onError)

Loads a JSON through Ajax call.

Parameters:
Name Type Description
uri String

location of the json document

onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadOptions(resource, resources, onSuccess, onError)

Loads JSON options.

Parameters:
Name Type Description
resource Object | String

Resource to be loaded

resources Object

Map of resources

onSuccess function

onSuccess callback

onError function

onError callback

Source:

loadReferenceOptions(resource, onSuccess, onError)

Loads referenced JSON options.

Parameters:
Name Type Description
resource Object | String

Resource to be loaded.

onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadReferenceSchema(resource, onSuccess, onError)

Loads referenced JSON schema.

Parameters:
Name Type Description
resource Object | String

Resource to be loaded.

onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadSchema(resource, resources, onSuccess, onError)

Loads JSON schema.

Parameters:
Name Type Description
resource Object | String

Resource to be loaded

resources Object

Map of resources

onSuccess function

onSuccess callback

onError function

onError callback

Source:

loadTemplate(source, onSuccess, onError)

Loads a template (HTML or Text).

If the source is a URI, then it is loaded.
If it is not a URI, then the source is simply handed back.

Parameters:
Name Type Description
source Object | String

Source to be loaded.

onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadUri(uri, isJson, onSuccess, onError)

Loads a general document through Ajax call.

This uses jQuery to perform the Ajax call. If you need to customize connectivity to your own remote server,
this would be the appropriate place to do so.

Parameters:
Name Type Description
uri String

uri to be loaded

isJson Boolean

Whether the document is a JSON or not.

onSuccess function

onSuccess callback.

onError function

onError callback.

Source:

loadView(resource, resources, onSuccess, onError)

Loads JSON view.

Parameters:
Name Type Description
resource Object | String

Resource to be loaded

resources Object

Map of resources

onSuccess function

onSuccess callback

onError function

onError callback

Source: