public abstract class LocalGENASubscription extends GENASubscription<LocalService> implements PropertyChangeListener
Uses the ServiceManager
to read the initial state of
the LocalService
on instantation. Typically, the
registerOnService()
method is called next, and from this point forward all
ServiceManager.EVENTED_STATE_VARIABLES
property change
events are detected by this subscription. After moderation of state variable values
(frequency and range of changes), the GENASubscription.eventReceived()
method is called.
Delivery of the event message to the subscriber is not part of this class, but the
implementor of GENASubscription.eventReceived()
.
actualDurationSeconds, currentSequence, currentValues, requestedDurationSeconds, service, subscriptionId
Modifier | Constructor and Description |
---|---|
|
LocalGENASubscription(LocalService service,
Integer requestedDurationSeconds,
List<URL> callbackURLs) |
protected |
LocalGENASubscription(LocalService service,
List<URL> callbackURLs) |
Modifier and Type | Method and Description |
---|---|
void |
end(CancelReason reason)
Removes a property change listener on the
ServiceManager . |
abstract void |
ended(CancelReason reason) |
void |
establish() |
List<URL> |
getCallbackURLs() |
void |
incrementSequence() |
protected Set<String> |
moderateStateVariables(long currentTime,
Collection<StateVariableValue> values)
Checks whether a state variable is moderated, and if this change is within the maximum rate and range limits.
|
void |
propertyChange(PropertyChangeEvent e)
Moderates
ServiceManager.EVENTED_STATE_VARIABLES events and state variable
values, calls GENASubscription.eventReceived() . |
void |
registerOnService()
Adds a property change listener on the
ServiceManager . |
void |
setSubscriptionDuration(Integer requestedDurationSeconds) |
established, eventReceived, getActualDurationSeconds, getCurrentSequence, getCurrentValues, getRequestedDurationSeconds, getService, getSubscriptionId, setActualSubscriptionDurationSeconds, setSubscriptionId, toString
protected LocalGENASubscription(LocalService service, List<URL> callbackURLs) throws Exception
Exception
public void registerOnService()
ServiceManager
.public void establish()
public void end(CancelReason reason)
ServiceManager
.public void propertyChange(PropertyChangeEvent e)
ServiceManager.EVENTED_STATE_VARIABLES
events and state variable
values, calls GENASubscription.eventReceived()
.propertyChange
in interface PropertyChangeListener
protected Set<String> moderateStateVariables(long currentTime, Collection<StateVariableValue> values)
currentTime
- The current unix time.values
- The state variable values to moderate.public void incrementSequence()
public void setSubscriptionDuration(Integer requestedDurationSeconds)
requestedDurationSeconds
- If null
defaults to
UserConstants.DEFAULT_SUBSCRIPTION_DURATION_SECONDS
public abstract void ended(CancelReason reason)
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.