Class: Aggregator

Aggregator

The Widget handles the access to sensors.

abstractnew 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
  • module:WidgetHandle
  • module:WidgetHandleList

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.

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.

protectedwidgetsWidgetHandleList

List of subscribed Widgets.

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

inherited addSubscriber(_subscriber)

Adds a new Subscriber.
Name Type Description
_subscriber Subscriber Subscriber

addWidget(_widget)

Adds WidgetHandle.
Name Type Description
_widget WidgetHandle WidgetHandle

addWidgetSubscription(_widgetHandle, _callbacks)

Adds a new subscription to this Aggregator.
Name Type Description
_widgetHandle WidgetHandle Widget that should be subscribed.
_callbacks CallbackList required Callbacks

protectedaggregatorSetup()

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

inherited privatedataValid(_conditions){boolean}

Verifies if the attributes match to the specified conditions in case any exists.
Name Type Description
_conditions string List of Conditions that will be verified.

abstractgetAggregatorDescription(){WidgetDescription}

Returns the description of this component.
Returns the current Attributes that are saved in the cache.

inherited privategetCurrentTime(){Date}

Returns the current time.
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

inherited getName(){string}

Returns the name of the widget.
Returns the old Attributes.

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".
Returns the available AttributeTypes.

inherited getWidgetConstantAttributeTypes(){AttributeTypeList}

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

inherited abstractgetWidgetDescription(){WidgetDescription}

Returns the description of this component.
Returns the available WidgetHandles.
Function for initializing. Calls all initFunctions and will be called by the constructor.

protectedinitAttributes()

Retrieves all Attributes of the specified widgets. If the defined name in WidgetHandle does not match the name of the returned instance, the WidgetHandle will be removed from the list.

protectedinitCallbacks()

Retrieves all actual Callbacks of the specified Widgets.

protectedinitConstantAttributes()

Retrieves all ConstantAttributes of the specified widgets. If the defined name in WidgetHandle does not match the name of the returned instance, the WidgetHandle will be removed from the list.

protectedinitStorage(_name)

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

abstract,protectedinitWidgetHandles()

Initializes the Widget that should be subscribed. Called by aggregatorSetup().

protectedinitWidgetSubscription(_widgetHandle){CallbackList}

Subscribes to the widgets that are defined in the WidgetHandleList used in the initCallback method. If the defined name in WidgetHandle does not match the name of the returned instance, the WidgetHandle will be removed from the list.
Name Type Description
_widgetHandle WidgetHandle 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 abstract,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
Returns the last acquired Attributes.
Returns the specified Callbacks that can be subscribed.
Returns the ConstantAttributes.

inherited abstractqueryGenerator(_function)

Queries the associated sensor and updates the attributes with new values. Must be overridden by the subclasses.
Name Type Description
_function function nullable For alternative actions, because an asynchronous function can be used.

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(_key)

Removes WidgetHandle from list.
Name Type Description
_key String Id of the WidgetHandle
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.

abstract,protectedsetAggregatorAttributeValues()

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

abstract,protectedsetAggregatorCallbacks()

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

abstract,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(_widgetList)

Sets WidgetHandles.
Name Type Description
_widgetList WidgetHandleList | Array List of WidgetHandles

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(_widgetHandle)

Removes subscribed Widgets and deletes the entry for subscribers in the associated Widget.
Name Type Description
_widgetHandle WidgetHandle 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.