Package org.kaaproject.kaa.client.profile

Provides implementation of a profile management.

See: Description

Package org.kaaproject.kaa.client.profile Description

Provides implementation of a profile management.

The endpoint profile is a structured data set of an arbitrary complexity that describes the endpoint characteristics. It is used to classify endpoints into endpoint groups. The profile data structure is defined using the Apache Avro schema format. The Profile schema supports all Avro features: primitive types, complex types, arrays, maps, etc. The endpoint SDK is responsible for delivery of the profile to the Kaa server.

The developer is able to report profile updates to the endpoint SDK using a profile container. The profile related API varies depending on the target SDK platform, however the general approach is the same.

Assume a profile schema has the following form:
 {
     "name": "BasicEndpointProfile",
     "namespace": "org.kaaproject.kaa.client.example",
     "type": "record",
     "fields": [
         {
             "name": "data",
             "type": "string"
         }
     ]
 }
 
 
Below is an example of the profile container:
 // Assume, BasicEndpointProfile is a profile class auto-generated
 // according to predefined Avro schema
 public class BasicProfileContainer extends AbstractProfileContainer<BasicEndpointProfile> {
     private BasicEndpointProfile profile = new BasicEndpointProfile();

     \@Override
     public BasicEndpointProfile getProfile() {
         return profile;
     }

     \@Override
     protected Class<BasicEndpointProfile> getProfileClass() {
         return BasicEndpointProfile.class;
     }

     public void setNewProfile(BasicEndpointProfile profile) {
         this.profile = profile;
         // NOTE: Update method should be called to notify about changes in the profile.
         updateProfile();
     }
 }

 ...

 // Desktop Kaa client initialization based on BasicProfileContainer
 private void init(){
     //Create instance of desktop Kaa application
     Kaa kaa = new KaaDesktop();
     //Create client for Kaa SDK
     KaaClient client = kaa.getClient();
     //Create instance of profile container and set profile
     ProfileContainer container = new BasicProfileContainer(profile);
     container.setNewProfile(new BasicEndpointProfile("test profile data"));
     //Set simple profile container to the profile manager.
     client.getProfileManager().setProfileContainer(container);
     //Start Kaa
     kaa.start();
 }
 
 
See Also:
org.kaaproject.kaa.client.profile.AbstractProfileContainer, ProfileManager

Copyright © 2015. All rights reserved.