Class: Aggregator

Aggregator

The Widget handles the access to sensors.

virtualnew Aggregator()

Constructor: Generates the id and initializes the Aggregator.

Extends

Requires

  • module:easejs
  • module:MathUuid
  • module:CallbackList
  • module:AttributeType
  • module:AttributeValue
  • module:AttributeValueList
  • module:Subscriber
  • module:SubscriberList
  • module:Storage
  • module:Widget

Members

protectedattributesAttributeValueList

All available Attributes and their values.

protectedattributeTypesAttributeTypeList

Types of all available attributes.

protectedcallbacksCallbackList

List of Callbacks.

protectedconstantAttributesAttributeValueList

All available constant Attributes and their values.

protectedconstantAttributeTypesAttributeTypeList

Types of all available ConstantAttributes.

protecteddbStorage

Database of the Aggregator.

protecteddiscovererDiscoverer

Associated discoverer.

idstring

ID of the Aggregator. Will be generated.

protectedinterpretersArray

List of subscribed interpreters referenced by ID.

namestring

Name of the Widget.

protectedoldAttributesAttributeValueList

This temporary variable is used for storing the old attribute values. So these can be used to check conditions.

protectedsubscribersSubscriberList

List of Subscriber.

protectedwidgetsArray

List of subscribed widgets referenced by ID.

Methods

inherited addAttribute(_attribute)

Adds a new AttributeValue. If the given value is not included in the list, the associated type will be also added. Otherwise, only the value will be updated.
Name Type Description
_attribute AttributeValue AttributeValue

protectedaddAttributeType(_attributeType)

Adds new AttributeTypes, useful when a new Widget is subscribed.
Name Type Description
_attributeType AttributeType attributeType

inherited protectedaddCallback(_callback)

Adds a new Callback.
Name Type Description
_callback Callback List or Array of AttributeValues.

inherited protectedaddConstantAttribute(_constantAttribute)

Adds a new constantAttributeValue. If the given value is not included in the list, the associated type will be also added. Otherwise, only the value will be updated.
Name Type Description
_constantAttribute AttributeValue AttributeValue

addInterpreter(_theInterpreter)

Adds an interpreter to the aggregator.
Name Type Description
_theInterpreter

inherited addSubscriber(_subscriber)

Adds a new Subscriber.
Name Type Description
_subscriber Subscriber Subscriber

addWidget(_widgetIdOrWidget)

Adds Widget ID.
Name Type Description
_widgetIdOrWidget String | Widget Widget ID

addWidgetSubscription(_widgetIdOrWidget, _callbackList)

Adds the specified callbacks of a widget to the aggregator.
Name Type Description
_widgetIdOrWidget String | Widget | WidgetDescription Widget that should be subscribed.
_callbackList CallbackList required Callbacks

protectedaggregatorSetup()

InitMethod for Aggregators. Called by constructor. Initializes the associated Storage.

didFinishInitialization(_attributeTypes)

Start the setup of the aggregator after the initialisation has finished.
Name Type Description
_attributeTypes

virtualdidFinishSetup()

After the aggregator finished its setup start searching for component that satisfy the attributes that where requrested.

inherited getAttributes(_attributeTypeList){AttributeValueList}

Returns the last acquired attribute values.
Name Type Description
_attributeTypeList AttributeTypeList
Returns the available AttributeTypes.
Returns a list of callbacks that can be subscribed to.

inherited getCallbacks(){Array}

Returns the specified callbacks that can be subscribed to.
Returns the ConstantAttributes.
Returns the current Attributes that are saved in the cache.
Returns the description of this component.
Returns the id of the widget.

getInterpretedData(_interpreterId){AttributeValueList}

Calls the given Interpreter for getting the data.
Name Type Description
_interpreterId String ID of the searched Interpreter

getInterpreters(){Array}

Returns an array with the UUIDs of the interpreters that where added to the aggregator.
Returns:
UUIDs of the connected interpreters.

inherited getName(){string}

Returns the name of the widget.

getStorageOverview(){Array}

Returns an overview about the stored attributes. It may be that the overview about the stored attributes is not up to date, because an asynchronous function is used for the retrieval. For retrieving the current data, this function can be used as callback function in queryTables().
Returns the Subscriber.

getType(){string}

Returns the type of this class, in this case "Aggregator".

inherited getWidgetConstantAttributeTypes(){AttributeTypeList}

Returns the available ConstantAttributeTypes (attributes that do not change).

getWidgets(){Array}

Returns the available Widget IDs.
Function for initializing. Calls all initFunctions and will be called by the constructor.

protectedinitAttributes()

Retrieves all Attributes of the specified widgets.

protectedinitCallbacks()

Retrieves all actual Callbacks of the specified Widgets.

protectedinitConstantAttributes()

Retrieves all ConstantAttributes of the specified widgets.

protectedinitStorage(_name)

Initializes the database with the specified name.
Name Type Description
_name String Name of the Storage

protectedinitWidgetSubscription(_widgetId){CallbackList}

Subscribes to the widgets that are defined in the Widget ID List used in the initCallback method.
Name Type Description
_widgetId String Widget that should be subscribed.

interpretData(_interpreterId, _data, _function)

Calls the given Interpreter for interpretation the data.
Name Type Description
_interpreterId String ID of the searched Interpreter
_data AttributeValueList | Array data that should be interpreted
_function function nullable for additional actions, if an asynchronous function is used

inherited virtual,protectedintervalRunning(_interval)

Runs the context acquisition constantly in an interval. Can be called by init.
Name Type Description
_interval integer Interval in ms

inherited protectedisAttribute(_attribute){boolean}

Verifies whether the specified attributes is a provided Attribute.
Name Type Description
_attribute AttributeValue
Puts context data to Widget and expects an array.
Name Type Description
_data AttributeValueList | Array data that shall be input

queryAttribute(_name, _function)

Queries the database and returns the last retrieval result. It may be that the retrieval result is not up to date, because an asynchronous function is used for the retrieval. For retrieving the current data, this function can be used as callback function in retrieveStorage().
Name Type Description
_name String Name of the searched AtTributes.
_function function nullable for alternative actions, because an asynchronous function is used

inherited virtualqueryGenerator(_function)

Queries the associated sensor and updates the attributes with new values. Must be overridden by the subclasses. Overriding subclasses can call this.__super(_function) to invoke the provided callback function.
Name Type Description
_function function nullable For alternative actions, because an asynchronous function can be used.

queryReferencedComponents(_callback)

Query all referenced widgets and afterwards all connected interpreters.
Name Type Description
_callback function the callback to query after all components did finish their work.

queryReferencedInterpreters(_callback)

Let's all connected interpreters interpret data.
Name Type Description
_callback function The callback to query after all the interpreters did interprete data.

virtualqueryReferencedWidget(_widgetId, _callback)

Updates the information for the widget with the provided ID and calls the callback afterwards.
Name Type Description
_widgetId String The ID of the widget to query.
_callback Callback The callback to query after the widget was updated.

virtualqueryReferencedWidgets(_callback)

Updates all the widgets referenced by the aggregator and calls the provided callback afterwards.
Name Type Description
_callback function The callback to query after all the widget where updated.

queryTables(_function)

Only actualizes the attributeType cache in th database. For an alternativ action can be used a callback.
Name Type Description
_function function nullable for alternative actions, because an asynchronous function is used
Returns all available AttributeValues, Attributes and ConstantAtrributes.
Registers the component to the associated Discoverer.

inherited removeSubscriber(_subscriber)

Removes the specified Subscriber.
Name Type Description
_subscriber Subscriber Subscriber

protectedremoveWidget(_widgetId)

Removes Widget ID from list.
Name Type Description
_widgetId String Id of the Widget
Queries a specific table and only actualizes the storage cache. For an alternativ action can be used a callback.

inherited protectedsendToSubscriber(_callbackName)

Sends all Attributes, specified in the given callback, to components which are subscribed to this Callback.
Name Type Description
_callbackName string Name of the searched Callback.

virtual,protectedsetAggregatorAttributeValues()

Initializes the provided attributeValues that are only specific to the Aggregator. Called by aggregatorSetup().

virtual,protectedsetAggregatorCallbacks()

Initializes the provided Callbacks that are only specific to the Aggregator. Called by aggregatorSetup().

virtual,protectedsetAggregatorConstantAttributeValues()

Initializes the provided ConstantAttributeValues that are only specific to the Aggregator. Called by aggregatorSetup().

inherited protectedsetAttributes(_attributes)

Sets the AttributeValueList and also the associated AttributeTypes.
Name Type Description
_attributes AttributeValueList | Array List or Array of AttributeValues

inherited protectedsetCallbacks(_callbacks)

Sets Callbacks.
Name Type Description
_callbacks CallbackList | Array List or Array of Callbacks.

inherited protectedsetConstantAttributes(_constantAttributes)

Sets the ConstantAttributeValueList and also the associated AttributeTypes.
Name Type Description
_constantAttributes AttributeValueList | Array List or Array of AttributeValues

inherited setDiscoverer(_discoverer)

Sets the associated Discoverer and registers to that.
Name Type Description
_discoverer Discoverer Discoverer

inherited protectedsetId(_id)

Sets the id of the Widget.
Name Type Description
_id string Id of the Widget.

inherited protectedsetName(_name)

Sets the name of the Widget.
Name Type Description
_name string Name of the Widget.

inherited protectedsetSubscriber(_subscriber)

Sets SubscriberList.
Name Type Description
_subscriber SubscriberList | Array List or Array of Subscriber.

protectedsetWidgets(_widgetIds)

Sets Widget IDs.
Name Type Description
_widgetIds Array List of Widget IDs

protectedstore(_attributeValue)

Stores the data.
Name Type Description
_attributeValue AttributeValue data that should be stored

protectedsubscribeTo(_widget, _callbacks)

Subscribes to the given widget for the specified Callbacks.
Name Type Description
_widget Widget Widget that should be subscribed to.
_callbacks CallbackList required Callbacks

unsubscribeFrom(_widgetId)

Removes subscribed Widgets and deletes the entry for subscribers in the associated Widget.
Name Type Description
_widgetId String Widget that should be removed.

inherited updateAndQueryWidget(_function){AttributeValueList}

Updates and returns all available AttributeValues, Attributes and ConstantAtrributes.
Name Type Description
_function function nullable For alternative actions, because an asynchronous function can be used.

inherited updateWidgetInformation(_function)

Updates the attributes by calling queryGenerator.
Name Type Description
_function function nullable For alternative actions, because an asynchronous function can be used.