org.apache.shindig.social.sample.spi
Class JsonDbOpensocialService

java.lang.Object
  extended by org.apache.shindig.social.sample.spi.JsonDbOpensocialService
All Implemented Interfaces:
ActivityService, ActivityStreamService, AlbumService, AppDataService, MediaItemService, MessageService, PersonService

public class JsonDbOpensocialService
extends java.lang.Object
implements ActivityService, PersonService, AppDataService, MessageService, AlbumService, MediaItemService, ActivityStreamService

Implementation of supported services backed by a JSON DB.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.shindig.social.opensocial.spi.MessageService
MessageService.NotImplementedMessageService
 
Nested classes/interfaces inherited from interface org.apache.shindig.social.opensocial.spi.AlbumService
AlbumService.NotImplementedAlbumService
 
Nested classes/interfaces inherited from interface org.apache.shindig.social.opensocial.spi.MediaItemService
MediaItemService.NotImplementedMediaItemService
 
Field Summary
 
Fields inherited from interface org.apache.shindig.social.opensocial.spi.PersonService
ALL_FILTER, HAS_APP_FILTER, IS_WITH_FRIENDS_FILTER, TOP_FRIENDS_FILTER, TOP_FRIENDS_SORT
 
Constructor Summary
JsonDbOpensocialService(java.lang.String jsonLocation, BeanConverter converter, java.lang.String contextroot)
          Initializes the JsonDbOpensocialService using Guice
 
Method Summary
 java.util.concurrent.Future<java.lang.Void> createActivity(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, Activity activity, SecurityToken token)
          Creates the passed in activity for the passed in user and group.
 java.util.concurrent.Future<ActivityEntry> createActivityEntry(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, ActivityEntry activityEntry, SecurityToken token)
          Creates the passed in activity for the passed in user and group.
 java.util.concurrent.Future<java.lang.Void> createAlbum(UserId userId, java.lang.String appId, Album album, SecurityToken token)
          
 java.util.concurrent.Future<java.lang.Void> createMediaItem(UserId userId, java.lang.String appId, java.lang.String albumId, MediaItem mediaItem, SecurityToken token)
          
 java.util.concurrent.Future<java.lang.Void> createMessage(UserId userId, java.lang.String appId, java.lang.String msgCollId, Message message, SecurityToken token)
          Posts a message to the user's specified message collection, to be sent to the set of recipients specified in the message.
 java.util.concurrent.Future<MessageCollection> createMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token)
          Creates a new message collection for the given arguments
 java.util.concurrent.Future<java.lang.Void> deleteActivities(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> activityIds, SecurityToken token)
          Deletes the activity for the passed in user and group that corresponds to the activityId.
 java.util.concurrent.Future<java.lang.Void> deleteActivityEntries(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> activityIds, SecurityToken token)
          Deletes the activity for the passed in user and group that corresponds to the activityId.
 java.util.concurrent.Future<java.lang.Void> deleteAlbum(UserId userId, java.lang.String appId, java.lang.String albumId, SecurityToken token)
          
 java.util.concurrent.Future<java.lang.Void> deleteMediaItem(UserId userId, java.lang.String appId, java.lang.String albumId, java.lang.String mediaItemId, SecurityToken token)
          
 java.util.concurrent.Future<java.lang.Void> deleteMessageCollection(UserId userId, java.lang.String msgCollId, SecurityToken token)
          Deletes a message collection for the given arguments
 java.util.concurrent.Future<java.lang.Void> deleteMessages(UserId userId, java.lang.String msgCollId, java.util.List<java.lang.String> ids, SecurityToken token)
          Deletes a set of messages for a given user/message collection
 java.util.concurrent.Future<java.lang.Void> deletePersonData(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, SecurityToken token)
          Deletes data for the specified user and group.
<T> T
filterFields(JSONObject object, java.util.Set<java.lang.String> fields, java.lang.Class<T> clz)
           
 java.util.concurrent.Future<RestfulCollection<Activity>> getActivities(java.util.Set<UserId> userIds, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          Returns a list of activities that correspond to the passed in users and group.
 java.util.concurrent.Future<RestfulCollection<Activity>> getActivities(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, java.util.Set<java.lang.String> activityIds, SecurityToken token)
          Returns a set of activities for the passed in user and group that corresponds to a list of activityIds.
 java.util.concurrent.Future<Activity> getActivity(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, java.lang.String activityId, SecurityToken token)
          Returns an activity for the passed in user and group that corresponds to a single activityId.
 java.util.concurrent.Future<RestfulCollection<ActivityEntry>> getActivityEntries(java.util.Set<UserId> userIds, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          Returns a list of activities that correspond to the passed in users and group.
 java.util.concurrent.Future<RestfulCollection<ActivityEntry>> getActivityEntries(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, java.util.Set<java.lang.String> activityIds, SecurityToken token)
          Returns a set of activities for the passed in user and group that corresponds to a list of activityIds.
 java.util.concurrent.Future<ActivityEntry> getActivityEntry(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, java.lang.String activityId, SecurityToken token)
          Returns an activity for the passed in user and group that corresponds to a single activityId.
 java.util.concurrent.Future<Album> getAlbum(UserId userId, java.lang.String appId, java.util.Set<java.lang.String> fields, java.lang.String albumId, SecurityToken token)
          
 java.util.concurrent.Future<RestfulCollection<Album>> getAlbums(java.util.Set<UserId> userIds, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          
 java.util.concurrent.Future<RestfulCollection<Album>> getAlbums(UserId userId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, java.util.Set<java.lang.String> albumIds, SecurityToken token)
          
 JSONObject getDb()
          Allows access to the underlying json db.
 java.util.Set<java.lang.String> getIdSet(java.util.Set<UserId> users, GroupId group, SecurityToken token)
          Get the set of user id's for a set of users and a group
 java.util.concurrent.Future<MediaItem> getMediaItem(UserId userId, java.lang.String appId, java.lang.String albumId, java.lang.String mediaItemId, java.util.Set<java.lang.String> fields, SecurityToken token)
          
 java.util.concurrent.Future<RestfulCollection<MediaItem>> getMediaItems(java.util.Set<UserId> userIds, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          
 java.util.concurrent.Future<RestfulCollection<MediaItem>> getMediaItems(UserId userId, java.lang.String appId, java.lang.String albumId, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          
 java.util.concurrent.Future<RestfulCollection<MediaItem>> getMediaItems(UserId userId, java.lang.String appId, java.lang.String albumId, java.util.Set<java.lang.String> mediaItemIds, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          
 java.util.concurrent.Future<RestfulCollection<MessageCollection>> getMessageCollections(UserId userId, java.util.Set<java.lang.String> fields, CollectionOptions options, SecurityToken token)
          Returns a list of message collections corresponding to the given user
 java.util.concurrent.Future<RestfulCollection<Message>> getMessages(UserId userId, java.lang.String msgCollId, java.util.Set<java.lang.String> fields, java.util.List<java.lang.String> msgIds, CollectionOptions options, SecurityToken token)
          Returns a list of messages that correspond to the passed in data
 java.lang.String getPassword(java.lang.String username)
          Public methods for use with Authentication Classes
 java.util.concurrent.Future<RestfulCollection<Person>> getPeople(java.util.Set<UserId> userIds, GroupId groupId, CollectionOptions options, java.util.Set<java.lang.String> fields, SecurityToken token)
          Returns a list of people that correspond to the passed in person ids.
 java.util.concurrent.Future<Person> getPerson(UserId id, java.util.Set<java.lang.String> fields, SecurityToken token)
          Returns a person that corresponds to the passed in person id.
 java.util.concurrent.Future<DataCollection> getPersonData(java.util.Set<UserId> userIds, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, SecurityToken token)
          Retrives app data for the specified user list and group.
 java.util.concurrent.Future<java.lang.Void> modifyMessage(UserId userId, java.lang.String msgCollId, java.lang.String messageId, Message message, SecurityToken token)
          Modifies/Updates a specific message with new data
 java.util.concurrent.Future<java.lang.Void> modifyMessageCollection(UserId userId, MessageCollection msgCollection, SecurityToken token)
          Modifies/Updates a message collection for the given arguments
 void setAuthority(Authority authority)
           
 void setDb(JSONObject db)
          override the json database
 java.util.concurrent.Future<ActivityEntry> updateActivityEntry(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, ActivityEntry activityEntry, java.lang.String activityId, SecurityToken token)
          Updates the specified Activity.
 java.util.concurrent.Future<java.lang.Void> updateAlbum(UserId userId, java.lang.String appId, Album album, java.lang.String albumId, SecurityToken token)
          
 java.util.concurrent.Future<java.lang.Void> updateMediaItem(UserId userId, java.lang.String appId, java.lang.String albumId, java.lang.String mediaItemId, MediaItem mediaItem, SecurityToken token)
          
 java.util.concurrent.Future<Person> updatePerson(UserId id, Person person, SecurityToken token)
          Updates person that corresponds to the passed in person id and updates him
 java.util.concurrent.Future<java.lang.Void> updatePersonData(UserId userId, GroupId groupId, java.lang.String appId, java.util.Set<java.lang.String> fields, java.util.Map<java.lang.String,java.lang.String> values, SecurityToken token)
          Updates app data for the specified user and group with the new values.
protected  boolean viewerCanUpdatePerson(java.lang.String viewer, java.lang.String person)
          Check if a viewer is allowed to update the given person record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonDbOpensocialService

@Inject
public JsonDbOpensocialService(java.lang.String jsonLocation,
                                      BeanConverter converter,
                                      java.lang.String contextroot)
                        throws java.lang.Exception
Initializes the JsonDbOpensocialService using Guice

Parameters:
jsonLocation - location of the json data provided by the shindig.canonical.json.db parameter
converter - an injected BeanConverter
Throws:
java.lang.Exception - if any
Method Detail

getDb

public JSONObject getDb()
Allows access to the underlying json db.

Returns:
a reference to the json db

setDb

public void setDb(JSONObject db)
override the json database

Parameters:
db - a JSONObject.

setAuthority

@Inject(optional=true)
public void setAuthority(Authority authority)

getActivities

public java.util.concurrent.Future<RestfulCollection<Activity>> getActivities(java.util.Set<UserId> userIds,
                                                                              GroupId groupId,
                                                                              java.lang.String appId,
                                                                              java.util.Set<java.lang.String> fields,
                                                                              CollectionOptions options,
                                                                              SecurityToken token)
                                                                       throws ProtocolException
Returns a list of activities that correspond to the passed in users and group.

Specified by:
getActivities in interface ActivityService
Parameters:
userIds - The set of ids of the people to fetch activities for.
groupId - Indicates whether to fetch activities for a group.
appId - The app id.
fields - The fields to return. Empty set implies all
options - The sorting/filtering/pagination options
token - A valid SecurityToken
Returns:
a response item with the list of activities.
Throws:
ProtocolException

getActivities

public java.util.concurrent.Future<RestfulCollection<Activity>> getActivities(UserId userId,
                                                                              GroupId groupId,
                                                                              java.lang.String appId,
                                                                              java.util.Set<java.lang.String> fields,
                                                                              CollectionOptions options,
                                                                              java.util.Set<java.lang.String> activityIds,
                                                                              SecurityToken token)
                                                                       throws ProtocolException
Returns a set of activities for the passed in user and group that corresponds to a list of activityIds.

Specified by:
getActivities in interface ActivityService
Parameters:
userId - The set of ids of the people to fetch activities for.
groupId - Indicates whether to fetch activities for a group.
appId - The app id.
fields - The fields to return. Empty set implies all
options - The sorting/filtering/pagination options
activityIds - The set of activity ids to fetch.
token - A valid SecurityToken
Returns:
a response item with the list of activities.
Throws:
ProtocolException

getActivity

public java.util.concurrent.Future<Activity> getActivity(UserId userId,
                                                         GroupId groupId,
                                                         java.lang.String appId,
                                                         java.util.Set<java.lang.String> fields,
                                                         java.lang.String activityId,
                                                         SecurityToken token)
                                                  throws ProtocolException
Returns an activity for the passed in user and group that corresponds to a single activityId.

Specified by:
getActivity in interface ActivityService
Parameters:
userId - The set of ids of the people to fetch activities for.
groupId - Indicates whether to fetch activities for a group.
appId - The app id.
fields - The fields to return. Empty set implies all
activityId - The activity id to fetch.
token - A valid SecurityToken
Returns:
a response item with the list of activities.
Throws:
ProtocolException

deleteActivities

public java.util.concurrent.Future<java.lang.Void> deleteActivities(UserId userId,
                                                                    GroupId groupId,
                                                                    java.lang.String appId,
                                                                    java.util.Set<java.lang.String> activityIds,
                                                                    SecurityToken token)
                                                             throws ProtocolException
Deletes the activity for the passed in user and group that corresponds to the activityId.

Specified by:
deleteActivities in interface ActivityService
Parameters:
userId - The user.
groupId - The group.
appId - The app id.
activityIds - A list of activity ids to delete.
token - A valid SecurityToken.
Returns:
a response item containing any errors
Throws:
ProtocolException

createActivity

public java.util.concurrent.Future<java.lang.Void> createActivity(UserId userId,
                                                                  GroupId groupId,
                                                                  java.lang.String appId,
                                                                  java.util.Set<java.lang.String> fields,
                                                                  Activity activity,
                                                                  SecurityToken token)
                                                           throws ProtocolException
Creates the passed in activity for the passed in user and group. Once createActivity is called, getActivities will be able to return the Activity.

Specified by:
createActivity in interface ActivityService
Parameters:
userId - The id of the person to create the activity for.
groupId - The group.
appId - The app id.
fields - The fields to return.
activity - The activity to create.
token - A valid SecurityToken
Returns:
a response item containing any errors
Throws:
ProtocolException

getPeople

public java.util.concurrent.Future<RestfulCollection<Person>> getPeople(java.util.Set<UserId> userIds,
                                                                        GroupId groupId,
                                                                        CollectionOptions options,
                                                                        java.util.Set<java.lang.String> fields,
                                                                        SecurityToken token)
                                                                 throws ProtocolException
Returns a list of people that correspond to the passed in person ids.

Specified by:
getPeople in interface PersonService
Parameters:
userIds - A set of users
groupId - The group
options - How to filter, sort and paginate the collection being fetched
fields - The profile details to fetch. Empty set implies all
token - The gadget token @return a list of people.
Returns:
Future that returns a RestfulCollection of Person
Throws:
ProtocolException

getPerson

public java.util.concurrent.Future<Person> getPerson(UserId id,
                                                     java.util.Set<java.lang.String> fields,
                                                     SecurityToken token)
                                              throws ProtocolException
Returns a person that corresponds to the passed in person id.

Specified by:
getPerson in interface PersonService
Parameters:
id - The id of the person to fetch.
fields - The fields to fetch.
token - The gadget token
Returns:
a list of people.
Throws:
ProtocolException

updatePerson

public java.util.concurrent.Future<Person> updatePerson(UserId id,
                                                        Person person,
                                                        SecurityToken token)
                                                 throws ProtocolException
Updates person that corresponds to the passed in person id and updates him

Specified by:
updatePerson in interface PersonService
Parameters:
id - The id of the person to fetch.
token - The gadget token
Returns:
a list of people.
Throws:
ProtocolException

viewerCanUpdatePerson

protected boolean viewerCanUpdatePerson(java.lang.String viewer,
                                        java.lang.String person)
Check if a viewer is allowed to update the given person record.


getPersonData

public java.util.concurrent.Future<DataCollection> getPersonData(java.util.Set<UserId> userIds,
                                                                 GroupId groupId,
                                                                 java.lang.String appId,
                                                                 java.util.Set<java.lang.String> fields,
                                                                 SecurityToken token)
                                                          throws ProtocolException
Retrives app data for the specified user list and group.

Specified by:
getPersonData in interface AppDataService
Parameters:
userIds - A set of UserIds.
groupId - The group
appId - The app
fields - The fields to filter the data by. Empty set implies all
token - The security token
Returns:
The data fetched
Throws:
ProtocolException

deletePersonData

public java.util.concurrent.Future<java.lang.Void> deletePersonData(UserId userId,
                                                                    GroupId groupId,
                                                                    java.lang.String appId,
                                                                    java.util.Set<java.lang.String> fields,
                                                                    SecurityToken token)
                                                             throws ProtocolException
Deletes data for the specified user and group.

Specified by:
deletePersonData in interface AppDataService
Parameters:
userId - The user
groupId - The group
appId - The app
fields - The fields to delete. Empty set implies all
token - The security token
Returns:
an error if one occurs
Throws:
ProtocolException

updatePersonData

public java.util.concurrent.Future<java.lang.Void> updatePersonData(UserId userId,
                                                                    GroupId groupId,
                                                                    java.lang.String appId,
                                                                    java.util.Set<java.lang.String> fields,
                                                                    java.util.Map<java.lang.String,java.lang.String> values,
                                                                    SecurityToken token)
                                                             throws ProtocolException
Updates app data for the specified user and group with the new values.

Specified by:
updatePersonData in interface AppDataService
Parameters:
userId - The user
groupId - The group
appId - The app
fields - The fields to filter the data by. Empty set implies all
values - The values to set
token - The security token
Returns:
an error if one occurs
Throws:
ProtocolException

createMessage

public java.util.concurrent.Future<java.lang.Void> createMessage(UserId userId,
                                                                 java.lang.String appId,
                                                                 java.lang.String msgCollId,
                                                                 Message message,
                                                                 SecurityToken token)
                                                          throws ProtocolException
Posts a message to the user's specified message collection, to be sent to the set of recipients specified in the message. Post a message for a set of users.

Specified by:
createMessage in interface MessageService
Parameters:
userId - The user posting the message.
appId - The app id
msgCollId - The message collection Id to post to, default @outbox
message - The message to post
token - A valid security token @return a response item containing any errors/
Returns:
Void Future
Throws:
ProtocolException - when invalid parameters are given

getMessageCollections

public java.util.concurrent.Future<RestfulCollection<MessageCollection>> getMessageCollections(UserId userId,
                                                                                               java.util.Set<java.lang.String> fields,
                                                                                               CollectionOptions options,
                                                                                               SecurityToken token)
                                                                                        throws ProtocolException
Returns a list of message collections corresponding to the given user

Specified by:
getMessageCollections in interface MessageService
Parameters:
userId - The User to fetch for
fields - The fields to fetch for the message collections
options - Pagination, etal
token - Given security token for this request
Returns:
a collection of message collections.
Throws:
ProtocolException - when invalid parameters are given

deleteMessages

public java.util.concurrent.Future<java.lang.Void> deleteMessages(UserId userId,
                                                                  java.lang.String msgCollId,
                                                                  java.util.List<java.lang.String> ids,
                                                                  SecurityToken token)
                                                           throws ProtocolException
Deletes a set of messages for a given user/message collection

Specified by:
deleteMessages in interface MessageService
Parameters:
userId - The User to delete for
msgCollId - The Message Collection ID to delete from, default @all
ids - List of IDs to delete
token - Given Security Token for this request
Returns:
Future
Throws:
ProtocolException

getMessages

public java.util.concurrent.Future<RestfulCollection<Message>> getMessages(UserId userId,
                                                                           java.lang.String msgCollId,
                                                                           java.util.Set<java.lang.String> fields,
                                                                           java.util.List<java.lang.String> msgIds,
                                                                           CollectionOptions options,
                                                                           SecurityToken token)
                                                                    throws ProtocolException
Returns a list of messages that correspond to the passed in data Gets the messsages in an user's queue.

Specified by:
getMessages in interface MessageService
Parameters:
userId - The User to fetch for
msgCollId - The message Collection ID to fetch from, default @all
fields - The fields to fetch for the messages
msgIds - An explicit set of message ids to fetch
options - Options to control the fetch
token - Given security token for this request
Returns:
a collection of messages
Throws:
ProtocolException - when invalid parameters are given

createMessageCollection

public java.util.concurrent.Future<MessageCollection> createMessageCollection(UserId userId,
                                                                              MessageCollection msgCollection,
                                                                              SecurityToken token)
                                                                       throws ProtocolException
Creates a new message collection for the given arguments

Specified by:
createMessageCollection in interface MessageService
Parameters:
userId - The userId to create the message collection for
msgCollection - A message collection that is to be created
token - A security token for this request
Returns:
Data for the message collection that is created
Throws:
ProtocolException - when invalid parameters are given or not implemented

modifyMessage

public java.util.concurrent.Future<java.lang.Void> modifyMessage(UserId userId,
                                                                 java.lang.String msgCollId,
                                                                 java.lang.String messageId,
                                                                 Message message,
                                                                 SecurityToken token)
                                                          throws ProtocolException
Modifies/Updates a specific message with new data

Specified by:
modifyMessage in interface MessageService
Parameters:
userId - The User to modify for
msgCollId - The Message Collection ID to modify from, default @all
messageId - The messageId to modify
message - The message details to modify
token - Given Security Token for this request
Returns:
Future
Throws:
ProtocolException - for invalid parameters or missing messages or users

modifyMessageCollection

public java.util.concurrent.Future<java.lang.Void> modifyMessageCollection(UserId userId,
                                                                           MessageCollection msgCollection,
                                                                           SecurityToken token)
                                                                    throws ProtocolException
Modifies/Updates a message collection for the given arguments

Specified by:
modifyMessageCollection in interface MessageService
Parameters:
userId - The userId to modify the message collection for
msgCollection - Data for the message collection to be modified
token - A security token for this request
Throws:
ProtocolException - when invalid parameters are given or not implemented

deleteMessageCollection

public java.util.concurrent.Future<java.lang.Void> deleteMessageCollection(UserId userId,
                                                                           java.lang.String msgCollId,
                                                                           SecurityToken token)
                                                                    throws ProtocolException
Deletes a message collection for the given arguments

Specified by:
deleteMessageCollection in interface MessageService
Parameters:
userId - The userId to create the message collection for
msgCollId - Data for the message collection to be modified
token - A security token for this request
Returns:
Future
Throws:
ProtocolException - when invalid parameters are given, the message collection does not exist or not implemented

getPassword

public java.lang.String getPassword(java.lang.String username)
Public methods for use with Authentication Classes

Parameters:
username - a String object.
Returns:
a String object.

getIdSet

public java.util.Set<java.lang.String> getIdSet(java.util.Set<UserId> users,
                                                GroupId group,
                                                SecurityToken token)
                                         throws JSONException
Get the set of user id's for a set of users and a group

Parameters:
users - set of UserIds
group - the group
token - a token
Returns:
set of Id strings
Throws:
JSONException - if errors in Json

getAlbum

public java.util.concurrent.Future<Album> getAlbum(UserId userId,
                                                   java.lang.String appId,
                                                   java.util.Set<java.lang.String> fields,
                                                   java.lang.String albumId,
                                                   SecurityToken token)
                                            throws ProtocolException

Specified by:
getAlbum in interface AlbumService
Throws:
ProtocolException

getAlbums

public java.util.concurrent.Future<RestfulCollection<Album>> getAlbums(UserId userId,
                                                                       java.lang.String appId,
                                                                       java.util.Set<java.lang.String> fields,
                                                                       CollectionOptions options,
                                                                       java.util.Set<java.lang.String> albumIds,
                                                                       SecurityToken token)
                                                                throws ProtocolException

Specified by:
getAlbums in interface AlbumService
Throws:
ProtocolException

getAlbums

public java.util.concurrent.Future<RestfulCollection<Album>> getAlbums(java.util.Set<UserId> userIds,
                                                                       GroupId groupId,
                                                                       java.lang.String appId,
                                                                       java.util.Set<java.lang.String> fields,
                                                                       CollectionOptions options,
                                                                       SecurityToken token)
                                                                throws ProtocolException

Specified by:
getAlbums in interface AlbumService
Throws:
ProtocolException

deleteAlbum

public java.util.concurrent.Future<java.lang.Void> deleteAlbum(UserId userId,
                                                               java.lang.String appId,
                                                               java.lang.String albumId,
                                                               SecurityToken token)
                                                        throws ProtocolException

Specified by:
deleteAlbum in interface AlbumService
Throws:
ProtocolException

createAlbum

public java.util.concurrent.Future<java.lang.Void> createAlbum(UserId userId,
                                                               java.lang.String appId,
                                                               Album album,
                                                               SecurityToken token)
                                                        throws ProtocolException

Specified by:
createAlbum in interface AlbumService
Throws:
ProtocolException

updateAlbum

public java.util.concurrent.Future<java.lang.Void> updateAlbum(UserId userId,
                                                               java.lang.String appId,
                                                               Album album,
                                                               java.lang.String albumId,
                                                               SecurityToken token)
                                                        throws ProtocolException

Specified by:
updateAlbum in interface AlbumService
Throws:
ProtocolException

getMediaItem

public java.util.concurrent.Future<MediaItem> getMediaItem(UserId userId,
                                                           java.lang.String appId,
                                                           java.lang.String albumId,
                                                           java.lang.String mediaItemId,
                                                           java.util.Set<java.lang.String> fields,
                                                           SecurityToken token)
                                                    throws ProtocolException

Specified by:
getMediaItem in interface MediaItemService
Throws:
ProtocolException

getMediaItems

public java.util.concurrent.Future<RestfulCollection<MediaItem>> getMediaItems(UserId userId,
                                                                               java.lang.String appId,
                                                                               java.lang.String albumId,
                                                                               java.util.Set<java.lang.String> mediaItemIds,
                                                                               java.util.Set<java.lang.String> fields,
                                                                               CollectionOptions options,
                                                                               SecurityToken token)
                                                                        throws ProtocolException

Specified by:
getMediaItems in interface MediaItemService
Throws:
ProtocolException

getMediaItems

public java.util.concurrent.Future<RestfulCollection<MediaItem>> getMediaItems(UserId userId,
                                                                               java.lang.String appId,
                                                                               java.lang.String albumId,
                                                                               java.util.Set<java.lang.String> fields,
                                                                               CollectionOptions options,
                                                                               SecurityToken token)
                                                                        throws ProtocolException

Specified by:
getMediaItems in interface MediaItemService
Throws:
ProtocolException

getMediaItems

public java.util.concurrent.Future<RestfulCollection<MediaItem>> getMediaItems(java.util.Set<UserId> userIds,
                                                                               GroupId groupId,
                                                                               java.lang.String appId,
                                                                               java.util.Set<java.lang.String> fields,
                                                                               CollectionOptions options,
                                                                               SecurityToken token)
                                                                        throws ProtocolException

Specified by:
getMediaItems in interface MediaItemService
Throws:
ProtocolException

deleteMediaItem

public java.util.concurrent.Future<java.lang.Void> deleteMediaItem(UserId userId,
                                                                   java.lang.String appId,
                                                                   java.lang.String albumId,
                                                                   java.lang.String mediaItemId,
                                                                   SecurityToken token)
                                                            throws ProtocolException

Specified by:
deleteMediaItem in interface MediaItemService
Throws:
ProtocolException

createMediaItem

public java.util.concurrent.Future<java.lang.Void> createMediaItem(UserId userId,
                                                                   java.lang.String appId,
                                                                   java.lang.String albumId,
                                                                   MediaItem mediaItem,
                                                                   SecurityToken token)
                                                            throws ProtocolException

Specified by:
createMediaItem in interface MediaItemService
Throws:
ProtocolException

updateMediaItem

public java.util.concurrent.Future<java.lang.Void> updateMediaItem(UserId userId,
                                                                   java.lang.String appId,
                                                                   java.lang.String albumId,
                                                                   java.lang.String mediaItemId,
                                                                   MediaItem mediaItem,
                                                                   SecurityToken token)
                                                            throws ProtocolException

Specified by:
updateMediaItem in interface MediaItemService
Throws:
ProtocolException

updateActivityEntry

public java.util.concurrent.Future<ActivityEntry> updateActivityEntry(UserId userId,
                                                                      GroupId groupId,
                                                                      java.lang.String appId,
                                                                      java.util.Set<java.lang.String> fields,
                                                                      ActivityEntry activityEntry,
                                                                      java.lang.String activityId,
                                                                      SecurityToken token)
                                                               throws ProtocolException
Updates the specified Activity.

Specified by:
updateActivityEntry in interface ActivityStreamService
Parameters:
userId - The id of the person to update the activity for
groupId - The group
appId - The app id
fields - The fields to return
activityEntry - The updated activity
activityId - The id of the existing activity to update
token - A valid SecurityToken
Returns:
a response item containing any errors
Throws:
ProtocolException - if any

createActivityEntry

public java.util.concurrent.Future<ActivityEntry> createActivityEntry(UserId userId,
                                                                      GroupId groupId,
                                                                      java.lang.String appId,
                                                                      java.util.Set<java.lang.String> fields,
                                                                      ActivityEntry activityEntry,
                                                                      SecurityToken token)
                                                               throws ProtocolException
Creates the passed in activity for the passed in user and group. Once createActivity is called, getActivities will be able to return the Activity.

Specified by:
createActivityEntry in interface ActivityStreamService
Parameters:
userId - The id of the person to create the activity for.
groupId - The group.
appId - The app id.
fields - The fields to return.
activityEntry - The activity to create.
token - A valid SecurityToken
Returns:
a response item containing any errors
Throws:
ProtocolException - if any.

deleteActivityEntries

public java.util.concurrent.Future<java.lang.Void> deleteActivityEntries(UserId userId,
                                                                         GroupId groupId,
                                                                         java.lang.String appId,
                                                                         java.util.Set<java.lang.String> activityIds,
                                                                         SecurityToken token)
                                                                  throws ProtocolException
Deletes the activity for the passed in user and group that corresponds to the activityId.

Specified by:
deleteActivityEntries in interface ActivityStreamService
Parameters:
userId - The user.
groupId - The group.
appId - The app id.
activityIds - A list of activity ids to delete.
token - A valid SecurityToken.
Returns:
a response item containing any errors
Throws:
ProtocolException - if any.

getActivityEntry

public java.util.concurrent.Future<ActivityEntry> getActivityEntry(UserId userId,
                                                                   GroupId groupId,
                                                                   java.lang.String appId,
                                                                   java.util.Set<java.lang.String> fields,
                                                                   java.lang.String activityId,
                                                                   SecurityToken token)
                                                            throws ProtocolException
Returns an activity for the passed in user and group that corresponds to a single activityId.

Specified by:
getActivityEntry in interface ActivityStreamService
Parameters:
userId - The set of ids of the people to fetch activities for.
groupId - Indicates whether to fetch activities for a group.
appId - The app id.
fields - The fields to return. Empty set implies all
activityId - The activity id to fetch.
token - A valid SecurityToken
Returns:
a response item with the list of activities.
Throws:
ProtocolException - if any.

getActivityEntries

public java.util.concurrent.Future<RestfulCollection<ActivityEntry>> getActivityEntries(java.util.Set<UserId> userIds,
                                                                                        GroupId groupId,
                                                                                        java.lang.String appId,
                                                                                        java.util.Set<java.lang.String> fields,
                                                                                        CollectionOptions options,
                                                                                        SecurityToken token)
                                                                                 throws ProtocolException
Returns a list of activities that correspond to the passed in users and group.

Specified by:
getActivityEntries in interface ActivityStreamService
Parameters:
userIds - The set of ids of the people to fetch activities for.
groupId - Indicates whether to fetch activities for a group.
appId - The app id.
fields - The fields to return. Empty set implies all
options - The sorting/filtering/pagination options
token - A valid SecurityToken
Returns:
a response item with the list of activities.
Throws:
ProtocolException - if any.

getActivityEntries

public java.util.concurrent.Future<RestfulCollection<ActivityEntry>> getActivityEntries(UserId userId,
                                                                                        GroupId groupId,
                                                                                        java.lang.String appId,
                                                                                        java.util.Set<java.lang.String> fields,
                                                                                        CollectionOptions options,
                                                                                        java.util.Set<java.lang.String> activityIds,
                                                                                        SecurityToken token)
                                                                                 throws ProtocolException
Returns a set of activities for the passed in user and group that corresponds to a list of activityIds.

Specified by:
getActivityEntries in interface ActivityStreamService
Parameters:
userId - The set of ids of the people to fetch activities for.
groupId - Indicates whether to fetch activities for a group.
appId - The app id.
fields - The fields to return. Empty set implies all
options - The sorting/filtering/pagination options
activityIds - The set of activity ids to fetch.
token - A valid SecurityToken
Returns:
a response item with the list of activities.
Throws:
ProtocolException - if any.

filterFields

public <T> T filterFields(JSONObject object,
                          java.util.Set<java.lang.String> fields,
                          java.lang.Class<T> clz)
               throws JSONException
Throws:
JSONException


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.