public interface GenericKaaClient
Root interface for the Kaa client. This interface contain methods that are predefined and does not contain any auto-generated code.
ConfigurationStorage
,
NotificationManager
,
EventFamilyFactory
,
EndpointRegistrationManager
,
EventListenersResolver
,
KaaChannelManager
,
PublicKey
,
PrivateKey
,
KaaDataChannel
Modifier and Type | Method and Description |
---|---|
boolean |
addConfigurationListener(ConfigurationListener listener)
Register configuration update listener
|
void |
addNotificationListener(NotificationListener listener)
Add listener to receive all notifications (both for mandatory and
optional topics).
|
void |
addNotificationListener(String topicId,
NotificationListener listener)
Add listener to receive notifications relating to the specified topic.
|
void |
addTopicListListener(NotificationTopicListListener listener)
Add listener for notification topics' list updates.
|
void |
attachEndpoint(EndpointAccessToken endpointAccessToken,
OnAttachEndpointOperationCallback resultListener)
Updates with new endpoint attach request
OnAttachEndpointOperationCallback is populated with EndpointKeyHash of an
attached endpoint. |
void |
attachUser(String userVerifierToken,
String userExternalId,
String userAccessToken,
UserAttachCallback callback)
Creates user attach request using specified verifier.
|
void |
attachUser(String userExternalId,
String userAccessToken,
UserAttachCallback callback)
Creates user attach request using default verifier.
|
void |
detachEndpoint(EndpointKeyHash endpointKeyHash,
OnDetachEndpointOperationCallback resultListener)
Updates with new endpoint detach request
|
void |
findEventListeners(List<String> eventFQNs,
FindEventListenersCallback listener)
Submits an event listeners resolution request
|
KaaChannelManager |
getChannelManager()
Retrieves Kaa channel manager
|
PrivateKey |
getClientPrivateKey()
Retrieves the client's private key.
|
PublicKey |
getClientPublicKey()
Retrieves the client's public key.
|
String |
getEndpointAccessToken()
Retrieve an access token for a current endpoint
|
String |
getEndpointKeyHash()
Retrieves endpoint public key hash.
|
EventFamilyFactory |
getEventFamilyFactory()
Retrieves Kaa event family factory.
|
List<org.kaaproject.kaa.common.endpoint.gen.Topic> |
getTopics()
Retrieve a list of available notification topics.
|
boolean |
isAttachedToUser()
Checks if current endpoint is attached to user.
|
void |
pause()
Pauses Kaa's workflow.
|
String |
refreshEndpointAccessToken()
Generate new access token for a current endpoint
|
boolean |
removeConfigurationListener(ConfigurationListener listener)
Removes configuration update listener
|
void |
removeNotificationListener(NotificationListener listener)
Remove listener receiving all notifications (both for mandatory and
optional topics).
|
void |
removeNotificationListener(String topicId,
NotificationListener listener)
Remove listener receiving notifications for the specified topic.
|
void |
removeTopicListListener(NotificationTopicListListener listener)
Remove listener of notification topics' list updates.
|
void |
resume()
Resumes Kaa's workflow.
|
void |
setAttachedListener(AttachEndpointToUserCallback listener)
Sets callback for notifications when current endpoint is attached to user
|
void |
setConfigurationStorage(ConfigurationStorage storage)
Sets the configuration storage that will be used to persist configuration.
|
void |
setDetachedListener(DetachEndpointFromUserCallback listener)
Sets callback for notifications when current endpoint is detached from user
|
void |
setEndpointAccessToken(String token)
Set new access token for a current endpoint
|
void |
setLogStorage(LogStorage storage)
Set user implementation of a log storage.
|
void |
setLogUploadStrategy(LogUploadStrategy strategy)
Set user implementation of a log upload strategy.
|
void |
setProfileContainer(ProfileContainer container)
Sets profile container implemented by the user.
|
void |
start()
Starts Kaa's workflow.
|
void |
stop()
Stops Kaa's workflow.
|
void |
subscribeToTopic(String topicId)
Subscribe to notifications relating to the specified optional topic.
|
void |
subscribeToTopic(String topicId,
boolean forceSync)
Subscribe to notifications relating to the specified optional topic.
|
void |
subscribeToTopics(List<String> topicIds)
Subscribe to notifications relating to the specified list of optional
topics.
|
void |
subscribeToTopics(List<String> topicIds,
boolean forceSync)
Subscribe to notifications relating to the specified list of optional
topics.
|
void |
syncTopicsList()
Force sync of pending subscription changes with server.
|
void |
unsubscribeFromTopic(String topicId)
Unsubscribe from notifications relating to the specified optional topic.
|
void |
unsubscribeFromTopic(String topicId,
boolean forceSync)
Unsubscribe from notifications relating to the specified optional topic.
|
void |
unsubscribeFromTopics(List<String> topicIds)
Unsubscribe from notifications relating to the specified list of optional
topics.
|
void |
unsubscribeFromTopics(List<String> topicIds,
boolean forceSync)
Unsubscribe from notifications relating to the specified list of optional
topics.
|
void |
updateProfile()
Sync of updated profile with server
|
void start()
Starts Kaa's workflow.
AbstractKaaClient.start()
void stop()
AbstractKaaClient.stop()
void pause()
void resume()
void setProfileContainer(ProfileContainer container)
container
- User-defined containerProfileContainer
void updateProfile()
void setConfigurationStorage(ConfigurationStorage storage)
storage
- to use for configuration persistenceboolean addConfigurationListener(ConfigurationListener listener)
listener
- to registerboolean removeConfigurationListener(ConfigurationListener listener)
listener
- to registervoid addTopicListListener(NotificationTopicListListener listener)
Add listener for notification topics' list updates.
listener
- the listener to receive updates.NotificationTopicListListener
void removeTopicListListener(NotificationTopicListListener listener)
Remove listener of notification topics' list updates.
listener
- listener the listener which is no longer needs updates.NotificationTopicListListener
List<org.kaaproject.kaa.common.endpoint.gen.Topic> getTopics()
Retrieve a list of available notification topics.
void addNotificationListener(NotificationListener listener)
Add listener to receive all notifications (both for mandatory and optional topics).
listener
- Listener to receive notificationsNotificationListener
void addNotificationListener(String topicId, NotificationListener listener) throws UnavailableTopicException
Add listener to receive notifications relating to the specified topic.
Listener(s) for optional topics may be added/removed irrespective to whether subscription was already or not.
topicId
- Id of topic (both mandatory and optional).listener
- Listener to receive notifications.UnavailableTopicException
- Throw if unknown topic id is provided.NotificationListener
void removeNotificationListener(NotificationListener listener)
Remove listener receiving all notifications (both for mandatory and optional topics).
listener
- Listener to receive notificationsNotificationListener
void removeNotificationListener(String topicId, NotificationListener listener) throws UnavailableTopicException
Remove listener receiving notifications for the specified topic.
Listener(s) for optional topics may be added/removed irrespective to whether subscription was already or not.
topicId
- Id of topic (both mandatory and optional).listener
- Listener to receive notifications.UnavailableTopicException
- Throw if unknown topic id is provided.NotificationListener
void subscribeToTopic(String topicId) throws UnavailableTopicException
Subscribe to notifications relating to the specified optional topic.
topicId
- Id of a optional topic.UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.void subscribeToTopic(String topicId, boolean forceSync) throws UnavailableTopicException
Subscribe to notifications relating to the specified optional topic.
topicId
- Id of a optional topic.forceSync
- Define whether current subscription update should be accepted
immediately (see #sync()
).UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.syncTopicsList()
void subscribeToTopics(List<String> topicIds) throws UnavailableTopicException
Subscribe to notifications relating to the specified list of optional topics.
topicIds
- List of optional topic id.UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.void subscribeToTopics(List<String> topicIds, boolean forceSync) throws UnavailableTopicException
Subscribe to notifications relating to the specified list of optional topics.
topicIds
- List of optional topic id.forceSync
- Define whether current subscription update should be accepted
immediately (see #sync()
).UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.syncTopicsList()
void unsubscribeFromTopic(String topicId) throws UnavailableTopicException
Unsubscribe from notifications relating to the specified optional topic.
All previously added listeners will be removed automatically.
topicId
- Id of a optional topic.UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.void unsubscribeFromTopic(String topicId, boolean forceSync) throws UnavailableTopicException
Unsubscribe from notifications relating to the specified optional topic.
All previously added listeners will be removed automatically.
topicId
- Id of a optional topic.forceSync
- Define whether current subscription update should be accepted
immediately (see #sync()
).UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.syncTopicsList()
void unsubscribeFromTopics(List<String> topicIds) throws UnavailableTopicException
Unsubscribe from notifications relating to the specified list of optional topics.
All previously added listeners will be removed automatically.
topicIds
- List of optional topic id.UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.void unsubscribeFromTopics(List<String> topicIds, boolean forceSync) throws UnavailableTopicException
Unsubscribe from notifications relating to the specified list of optional topics.
All previously added listeners will be removed automatically.
topicIds
- List of optional topic id.forceSync
- Define whether current subscription update should be accepted
immediately (see #sync()
).UnavailableTopicException
- Throw if unknown topic id is provided or topic isn't
optional.syncTopicsList()
void syncTopicsList()
Force sync of pending subscription changes with server.
Should be used after all subscribeToTopic(String, boolean)
,
subscribeToTopics(List, boolean)
,
unsubscribeFromTopic(String, boolean)
,
unsubscribeFromTopics(List, boolean)
calls with parameter
forceSync
set to false
.
Use it as a convenient way to make different consequent changes in the optional subscription:
{ // Make subscription changes kaaClient.subscribeOnTopics(Arrays.asList("optional_topic1", "optional_topic2", "optional_topic3"), false); kaaClient.unsubscribeFromTopic("optional_topic4", false); // Add listeners for topics here // Commit changes kaaClient.syncTopicsList(); }
void setLogStorage(LogStorage storage)
storage
- User-defined log storage objectvoid setLogUploadStrategy(LogUploadStrategy strategy)
strategy
- User-defined log upload strategy object.EventFamilyFactory getEventFamilyFactory()
EventFamilyFactory
object.void findEventListeners(List<String> eventFQNs, FindEventListenersCallback listener)
eventFQNs
- List of event class FQNs which have to be supported by endpoint.listener
- Result listener FindEventListenersCallback
}KaaChannelManager getChannelManager()
KaaChannelManager
objectPublicKey getClientPublicKey()
Retrieves the client's public key.
Required in user implementation of an operation data channel. Public key hash (SHA-1) is used by servers as identification number to uniquely identify each connected endpoint.
String getEndpointKeyHash()
Retrieves endpoint public key hash.
Required in EndpointRegistrationManager
implementation to react
on detach response from Operations server.
PrivateKey getClientPrivateKey()
Retrieves the client's private key.
Required in user implementation of an operation data channel. Private key is used by encryption schema between endpoint and servers.
void setEndpointAccessToken(String token)
String refreshEndpointAccessToken()
String getEndpointAccessToken()
void attachEndpoint(EndpointAccessToken endpointAccessToken, OnAttachEndpointOperationCallback resultListener)
OnAttachEndpointOperationCallback
is populated with EndpointKeyHash
of an
attached endpoint.endpointAccessToken
- Access token of the attaching endpointresultListener
- Listener to notify about result of the endpoint attachingEndpointAccessToken
,
OnAttachEndpointOperationCallback
void detachEndpoint(EndpointKeyHash endpointKeyHash, OnDetachEndpointOperationCallback resultListener)
endpointKeyHash
- Key hash of the detaching endpointresultListener
- Listener to notify about result of the enpoint attachingEndpointKeyHash
,
OnDetachEndpointOperationCallback
void attachUser(String userExternalId, String userAccessToken, UserAttachCallback callback)
userExternalId
- userAccessToken
- callback
- called when authentication result receivedUserAttachCallback
void attachUser(String userVerifierToken, String userExternalId, String userAccessToken, UserAttachCallback callback)
userVerifierToken
- userExternalId
- userAccessToken
- callback
- called when authentication result receivedUserAttachCallback
boolean isAttachedToUser()
void setAttachedListener(AttachEndpointToUserCallback listener)
listener
- AttachEndpointToUserCallback
void setDetachedListener(DetachEndpointFromUserCallback listener)
listener
- DetachEndpointFromUserCallback
Copyright © 2015. All rights reserved.