AeroGear SimplePush Server API 0.11.0

org.jboss.aerogear.simplepush.server.datastore
Interface DataStore


public interface DataStore

Handles the storing of channels for a SimplePush Server implementation.


Method Summary
 Channel getChannel(String channelId)
          Returns the Channel for the passed-in channelId.
 Set<String> getChannelIds(String uaid)
          Returns registered channel ids for a certain UserAgent Identifier (uaid)
 byte[] getPrivateKeySalt()
          Returns the server's private key salt.
 Set<org.jboss.aerogear.simplepush.protocol.Ack> getUnacknowledged(String uaid)
          Returns the Acks that have been sent to a UserAgent as notifications.
 Set<org.jboss.aerogear.simplepush.protocol.Ack> removeAcknowledged(String uaid, Set<org.jboss.aerogear.simplepush.protocol.Ack> acked)
          Removes the Acks from storage which should be done when a UserAgent has acknowledged notifications.
 void removeChannels(Set<String> channelIds)
          Removes all channels matching the set passed in.
 void removeChannels(String uaid)
          Removes all channels for a certain UserAgent Identifier (uaid).
 boolean saveChannel(Channel channel)
          Saves the channel to the underlying storage system.
 void savePrivateKeySalt(byte[] salt)
          Saves the server's private key salt.
 String saveUnacknowledged(String channelId, long version)
           
 String updateVersion(String endpointToken, long version)
          Updates the version for a channel (identified by the endpointToken)
 

Method Detail

savePrivateKeySalt

void savePrivateKeySalt(byte[] salt)
Saves the server's private key salt.

Parameters:
salt - the server's private key salt.

getPrivateKeySalt

byte[] getPrivateKeySalt()
Returns the server's private key salt.

Returns:
byte[] the server's private key salt if one has previously been saved, or an empty byte array.

saveChannel

boolean saveChannel(Channel channel)
Saves the channel to the underlying storage system.

Parameters:
channel - the channel to be stored.
Returns:
true if storage was successful.

getChannel

Channel getChannel(String channelId)
                   throws ChannelNotFoundException
Returns the Channel for the passed-in channelId.

Parameters:
channelId - of the channel to be retrieved.
Returns:
Channel the matching Channel, or null if no channel with the channelId was found.
Throws:
ChannelNotFoundException

removeChannels

void removeChannels(String uaid)
Removes all channels for a certain UserAgent Identifier (uaid).

Parameters:
uaid - the UserAgent Identifier for which all channels that belongs to that id should be removed.

removeChannels

void removeChannels(Set<String> channelIds)
Removes all channels matching the set passed in.

Parameters:
channelIds - the ids of the channels to be removed.

getChannelIds

Set<String> getChannelIds(String uaid)
Returns registered channel ids for a certain UserAgent Identifier (uaid)

Parameters:
uaid - the UserAgent Identifier for which all channels that belongs to that id should be removed.
Returns:
Set<String> the registered channels.

updateVersion

String updateVersion(String endpointToken,
                     long version)
                     throws VersionException,
                            ChannelNotFoundException
Updates the version for a channel (identified by the endpointToken)

Parameters:
endpointToken - the unique identifier for the channel/uaid combination.
version - the version to update to.
Returns:
String The channel id of the updated channel
Throws:
VersionException
ChannelNotFoundException

saveUnacknowledged

String saveUnacknowledged(String channelId,
                          long version)
                          throws ChannelNotFoundException
Parameters:
channelId - the channelId that this update/ack belongs to.
version - the String the version of the update.
Returns:
String the UserAgent Id for the channel.
Throws:
ChannelNotFoundException

getUnacknowledged

Set<org.jboss.aerogear.simplepush.protocol.Ack> getUnacknowledged(String uaid)
Returns the Acks that have been sent to a UserAgent as notifications.

Parameters:
uaid - the String of the UserAgent
Returns:
Set<Update> the updates waiting for notification.

removeAcknowledged

Set<org.jboss.aerogear.simplepush.protocol.Ack> removeAcknowledged(String uaid,
                                                                   Set<org.jboss.aerogear.simplepush.protocol.Ack> acked)
Removes the Acks from storage which should be done when a UserAgent has acknowledged notifications.

Parameters:
uaid - the String of the UserAgent
acked - the Acks to be remove.

AeroGear SimplePush Server API 0.11.0

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.