~mugle-dev/mugle/trunk

« back to all changes in this revision

Viewing changes to src/au/edu/unimelb/csse/mugle/client/api/KeyValueService.java

  • Committer: Aidan Nagorcka-Smith
  • Date: 2012-03-11 13:33:37 UTC
  • mfrom: (467.1.4 multi-player)
  • Revision ID: aidanns@gmail.com-20120311133337-l6xcvspfjvgn27mo
Merged changes from multiplayer branch in to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
import au.edu.unimelb.csse.mugle.shared.api.GameTokenError;
26
26
import au.edu.unimelb.csse.mugle.shared.api.KeyError;
 
27
import au.edu.unimelb.csse.mugle.shared.multiplayer.api.InstanceTokenError;
27
28
 
28
29
/**
29
 
 * Developer API for accessing the key/value store.
30
 
 * This allows each game to associate arbitrary data with string keys,
31
 
 * independently for each user.
 
30
 * Developer API for accessing the key/value store. This allows each game to
 
31
 * associate arbitrary data with string keys, independently for each user.
32
32
 */
33
33
@RemoteServiceRelativePath("api-keyvalue")
34
 
public interface KeyValueService extends RemoteService
35
 
{
36
 
    /** Store an object in the key-value store.
37
 
     * The value will be specific to the current user, and will only be able
38
 
     * to be retrieved by the same user.
39
 
     * @param gameToken The secret token for the current game.
40
 
     * @param key The key to associate the object with.
41
 
     * @param value The object to store.
 
34
public interface KeyValueService extends RemoteService {
 
35
    /**
 
36
     * Store an object in the key-value store. The value will be specific to the
 
37
     * current user, and will only be able to be retrieved by the same user.
 
38
     * 
 
39
     * @param gameToken
 
40
     *            The secret token for the current game.
 
41
     * @param key
 
42
     *            The key to associate the object with.
 
43
     * @param value
 
44
     *            The object to store.
 
45
     * @deprecated use {@link #put(String, String, Serializable, String)}
 
46
     *             instead.
42
47
     */
 
48
    @Deprecated
43
49
    public void put(String gameToken, String key, Serializable value)
44
 
        throws GameTokenError;
45
 
 
46
 
    /** Retrieve an object from the key-value store.
47
 
     * The value will be the one stored by the current user.
48
 
     * @param gameToken The secret token for the current game.
49
 
     * @param key The key the object is associated with.
 
50
            throws GameTokenError;
 
51
 
 
52
    /**
 
53
     * Store an object in the key-value store. The value will be specific to the
 
54
     * current user, and will only be able to be retrieved by the same user.
 
55
     * 
 
56
     * @param gameToken
 
57
     *            The secret token for the current game.
 
58
     * @param key
 
59
     *            The key to associate the object with.
 
60
     * @param value
 
61
     *            The object to store.
 
62
     * @param instanceToken
 
63
     *            The secret token for the current game instance. If not null
 
64
     *            then it's retrieved from the user game instance profile.
 
65
     *            Otherwise it's retrieved from the user game profile.
 
66
     */
 
67
    public void put(String gameToken, String key, Serializable value,
 
68
            String instanceToken) throws GameTokenError, InstanceTokenError;
 
69
 
 
70
    /**
 
71
     * Retrieve an object from the key-value store. The value will be the one
 
72
     * stored by the current user.
 
73
     * 
 
74
     * @param gameToken
 
75
     *            The secret token for the current game.
 
76
     * @param key
 
77
     *            The key the object is associated with.
50
78
     * @return The object associated with the key.
51
 
     * @throws KeyError If no object is associated with that key.
 
79
     * @throws KeyError
 
80
     *             If no object is associated with that key.
 
81
     * @deprecated use {@link #get(String, String, String)} instead.
52
82
     */
 
83
    @Deprecated
53
84
    public Serializable get(String gameToken, String key)
54
 
        throws GameTokenError, KeyError;
55
 
 
56
 
    /** Test whether a key has an associated object for the current user.
57
 
     * @param gameToken The secret token for the current game.
58
 
     * @param key The key the object is associated with.
 
85
            throws GameTokenError, KeyError;
 
86
 
 
87
    /**
 
88
     * Retrieve an object from the key-value store. The value will be the one
 
89
     * stored by the current user.
 
90
     * 
 
91
     * @param gameToken
 
92
     *            The secret token for the current game.
 
93
     * @param key
 
94
     *            The key the object is associated with.
 
95
     * @param instanceToken
 
96
     *            The secret token for the current game instance. If not null
 
97
     *            then it's retrieved from the user game instance profile.
 
98
     *            Otherwise it's retrieved from the user game profile.
 
99
     * @return The object associated with the key.
 
100
     * @throws KeyError
 
101
     *             If no object is associated with that key.
 
102
     * @throws InstanceTokenError
 
103
     */
 
104
    public Serializable get(String gameToken, String key, String instanceToken)
 
105
            throws GameTokenError, KeyError, InstanceTokenError;
 
106
 
 
107
    /**
 
108
     * Test whether a key has an associated object for the current user.
 
109
     * 
 
110
     * @param gameToken
 
111
     *            The secret token for the current game.
 
112
     * @param key
 
113
     *            The key the object is associated with.
59
114
     * @return True if a value is associated with the key.
 
115
     * @deprecated use {@link #containsKey(String, String, String)} instead.
60
116
     */
 
117
    @Deprecated
61
118
    public boolean containsKey(String gameToken, String key)
62
 
        throws GameTokenError;
 
119
            throws GameTokenError;
 
120
 
 
121
    /**
 
122
     * Test whether a key has an associated object for the current user.
 
123
     * 
 
124
     * @param gameToken
 
125
     *            The secret token for the current game.
 
126
     * @param key
 
127
     *            The key the object is associated with.
 
128
     * @param instanceToken
 
129
     *            The secret token for the current game instance. If not null
 
130
     *            then it's retrieved from the user game instance profile.
 
131
     *            Otherwise it's retrieved from the user game profile.
 
132
     * @return True if a value is associated with the key.
 
133
     * @throws InstanceTokenError
 
134
     */
 
135
    public boolean containsKey(String gameToken, String key,
 
136
            String instanceToken) throws GameTokenError, InstanceTokenError;
63
137
}