public interface ProfileManager
Interface for the profile manager.
Responsible for the management of the user-defined profile container
(AbstractProfileContainer
)
Profile manager is used to track any profile updates. If no container is set, Kaa won't be able to process these updates.
// Assume, BasicEndpointProfile is a profile class auto-generated according to predefined Avro schema
public class BasicProfileContainer extends AbstractProfileContainer<BasicEndpointProfile> {
private BasicEndpointProfile profile = new BasicEndpointProfile();
public BasicProfileContainer() {}
public BasicEndpointProfile getProfile() {
return profile;
}
protected Class<BasicEndpointProfile> getProfileClass() {
return BasicEndpointProfile.class;
}
// User-define method
public void setNewProfile(BasicEndpointProfile profile) {
this.profile = profile;
// Update method should be called to notify about changes in the profile.
updateProfile();
}
}
BasicProfileContainer container = new BasicProfileContainer();
ProfileManager manager = kaaClient.getProfileManager();
manager.setProfileContainer(container);
// Assume, profile is changed. Current implementation of the profile container
// notifies Kaa inner stuff about profile update.
container.setNewProfile(new BasicEndpointProfile());
AbstractProfileContainer
,
SerializedProfileContainer
Modifier and Type | Method and Description |
---|---|
SerializedProfileContainer |
getSerializedProfileContainer()
Retrieves container responsible for profile serializing
|
void |
setProfileContainer(ProfileContainer container)
Sets profile container implemented by the user.
|
void setProfileContainer(ProfileContainer container)
container
- User-defined containerAbstractProfileContainer
SerializedProfileContainer getSerializedProfileContainer()
Copyright © 2015. All rights reserved.