org.apache.shindig.extras.as.sample
Class ActivityStreamsJsonDbService

java.lang.Object
  extended by org.apache.shindig.extras.as.sample.ActivityStreamsJsonDbService
All Implemented Interfaces:
ActivityStreamService

public class ActivityStreamsJsonDbService
extends Object
implements ActivityStreamService

Sample Implementation of the ActivityStreams Service using a JSON database.


Constructor Summary
ActivityStreamsJsonDbService(JsonDbOpensocialService jsonDb, BeanConverter converter)
          Create a new ActivityStreamsJsonDbService instance via Guice injection
 
Method Summary
 Future<Void> createActivityEntry(UserId userId, GroupId groupId, String appId, Set<String> fields, ActivityEntry activityEntry, SecurityToken token)
          Creates the passed in activity for the passed in user and group.
 Future<Void> deleteActivityEntries(UserId userId, GroupId groupId, String appId, Set<String> activityIds, SecurityToken token)
          Deletes the activity for the passed in user and group that corresponds to the activityId.
 Future<RestfulCollection<ActivityEntry>> getActivityEntries(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token)
          Returns a list of activities that correspond to the passed in users and group.
 Future<RestfulCollection<ActivityEntry>> getActivityEntries(UserId userId, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, Set<String> activityIds, SecurityToken token)
          Returns a set of activities for the passed in user and group that corresponds to a list of activityIds.
 Future<ActivityEntry> getActivityEntry(UserId userId, GroupId groupId, String appId, Set<String> fields, String activityId, SecurityToken token)
          Returns an activity for the passed in user and group that corresponds to a single activityId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityStreamsJsonDbService

@Inject
public ActivityStreamsJsonDbService(JsonDbOpensocialService jsonDb,
                                           BeanConverter converter)
Create a new ActivityStreamsJsonDbService instance via Guice injection

Parameters:
jsonDb - a JsonDbOpensocialService object.
converter - a BeanConverter object annotated with "shindig.bean.converter.json".
Method Detail

createActivityEntry

public Future<Void> createActivityEntry(UserId userId,
                                        GroupId groupId,
                                        String appId,
                                        Set<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 Future<Void> deleteActivityEntries(UserId userId,
                                          GroupId groupId,
                                          String appId,
                                          Set<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 Future<ActivityEntry> getActivityEntry(UserId userId,
                                              GroupId groupId,
                                              String appId,
                                              Set<String> fields,
                                              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 Future<RestfulCollection<ActivityEntry>> getActivityEntries(Set<UserId> userIds,
                                                                   GroupId groupId,
                                                                   String appId,
                                                                   Set<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 Future<RestfulCollection<ActivityEntry>> getActivityEntries(UserId userId,
                                                                   GroupId groupId,
                                                                   String appId,
                                                                   Set<String> fields,
                                                                   CollectionOptions options,
                                                                   Set<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.


Copyright © 2007-2012. All Rights Reserved.