AI2 Component  (Version nb184) Class Reference
Inheritance diagram for

Public Member Functions

 CloudDB (ComponentContainer container)
void Initialize ()
void onClear ()
void onDestroy ()
void RedisServer (String servername)
String RedisServer ()
void DefaultRedisServer (String server)
void RedisPort (int port)
int RedisPort ()
String ProjectID ()
void ProjectID (String id)
void Token (String authToken)
String Token ()
void UseSSL (boolean useSSL)
boolean UseSSL ()
void StoreValue (final String tag, final Object valueToStore)
void GetValue (final String tag, final Object valueIfTagNotThere)
boolean CloudConnected ()
void FirstRemoved (Object value)
void RemoveFirstFromList (final String tag)
void AppendValueToList (final String tag, final Object itemToAdd)
void GotValue (String tag, Object value)
void ClearTag (final String tag)
void GetTagList ()
void TagList (List< String > value)
void DataChanged (final String tag, final Object value)
void CloudDBError (final String message)
Form getForm ()
Jedis getJedis (boolean createNew)
synchronized Jedis getJedis ()
ExecutorService getBackground ()
Object jEval (String script, String scriptsha1, int argcount, String... args) throws JedisException
- Public Member Functions inherited from
HandlesEventDispatching getDispatchDelegate ()

Additional Inherited Members

- Static Public Attributes inherited from
static final String ASSET_DIRECTORY = "component"
static final int ALIGNMENT_NORMAL = 0
static final int ALIGNMENT_CENTER = 1
static final int ALIGNMENT_OPPOSITE = 2
static final int BUTTON_SHAPE_DEFAULT = 0
static final int BUTTON_SHAPE_ROUNDED = 1
static final int BUTTON_SHAPE_RECT = 2
static final int BUTTON_SHAPE_OVAL = 3
static final int COLOR_NONE = 0x00FFFFFF
static final int COLOR_BLACK = 0xFF000000
static final int COLOR_BLUE = 0xFF0000FF
static final int COLOR_CYAN = 0xFF00FFFF
static final int COLOR_DKGRAY = 0xFF444444
static final int COLOR_GRAY = 0xFF888888
static final int COLOR_GREEN = 0xFF00FF00
static final int COLOR_LTGRAY = 0xFFCCCCCC
static final int COLOR_MAGENTA = 0xFFFF00FF
static final int COLOR_ORANGE = 0xFFFFC800
static final int COLOR_PINK = 0xFFFFAFAF
static final int COLOR_RED = 0xFFFF0000
static final int COLOR_WHITE = 0xFFFFFFFF
static final int COLOR_YELLOW = 0xFFFFFF00
static final int COLOR_DEFAULT = 0x00000000
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
static final float FONT_DEFAULT_SIZE = 14
static final int SCALING_SCALE_TO_FIT = 1
static final int TYPEFACE_DEFAULT = 0
static final int TYPEFACE_SANSSERIF = 1
static final int TYPEFACE_SERIF = 2
static final int TYPEFACE_MONOSPACE = 3
static final int LENGTH_PREFERRED = -1
static final int LENGTH_FILL_PARENT = -2
static final int LENGTH_UNKNOWN = -3
static final int LENGTH_PERCENT_TAG = -1000
static final int TOAST_LENGTH_SHORT = 0
static final int TOAST_LENGTH_LONG = 1
static final int DIRECTION_NORTH = 1
static final int DIRECTION_NORTHEAST = 2
static final int DIRECTION_EAST = 3
static final int DIRECTION_SOUTHEAST = 4
static final int DIRECTION_SOUTH = -1
static final int DIRECTION_SOUTHWEST = -2
static final int DIRECTION_WEST = -3
static final int DIRECTION_NORTHWEST = -4
static final int DIRECTION_NONE = 0
static final int DIRECTION_MIN = -4
static final int DIRECTION_MAX = 4
static float SLIDER_MIN_VALUE = 10
static float SLIDER_MAX_VALUE = 50
- Protected Member Functions inherited from
 AndroidNonvisibleComponent (Form form)
- Protected Attributes inherited from
final Form form

Detailed Description

The CloudDB component is a Non-visible component that allows you to store data on a Internet connected database server (using Redis software). This allows the users of your App to share data with each other. By default data will be stored in a server maintained by MIT, however you can setup and run your own server. Set the RedisServer(String) property and RedisPort(int) property to access your own server.

@internaldoc The component has methods to store a value under a tag and to retrieve the value associated with the tag. It also possesses a listener to fire events when stored values are changed. It also posseses a sync capability which helps CloudDB to sync with data collected offline.

Author (Natalie Lao) (Joydeep Mitra) (Jeffrey I. Schiller)

Definition at line 110 of file

Constructor & Destructor Documentation

◆ CloudDB() ( ComponentContainer  container)

Creates a new CloudDB component.

containerthe Form that this component is contained in.

Definition at line 274 of file

Member Function Documentation

◆ AppendValueToList()

void ( final String  tag,
final Object  itemToAdd 

Definition at line 964 of file

◆ ClearTag()

void ( final String  tag)

Remove the tag from CloudDB.

@internaldoc Asks CloudDB to forget (delete or set to "null") a given tag.

tagThe tag to remove

Definition at line 1036 of file

◆ CloudConnected()

boolean ( )

Returns true{:.logic.block} if we are on the network and will likely be able to connect to the CloudDB server.

true if the network is connected, otherwise false

Definition at line 844 of file

◆ CloudDBError()

void ( final String  message)

Indicates that an error occurred while communicating with the CloudDB Redis server.

messagethe error message

Definition at line 1141 of file

◆ DataChanged()

void ( final String  tag,
final Object  value 

Indicates that the data in the CloudDB project has changed. Launches an event with the tag{:.text.block} that has been updated and the value{:.variable.block} it now has.

tagthe tag that has changed.
valuethe new value of the tag.

Definition at line 1115 of file

◆ DefaultRedisServer()

void ( String  server)

Definition at line 448 of file

◆ FirstRemoved()

void ( Object  value)

Event triggered by the RemoveFirstFromList(String) function. The argument value{:.variable.block} is the object that was the first in the list, and which is now removed.

valuethe value removed from the beginning of the list

Definition at line 860 of file

◆ getBackground()

ExecutorService ( )

Definition at line 1309 of file

◆ getForm()

Form ( )

Definition at line 1167 of file

◆ getJedis() [1/2]

synchronized Jedis ( )

Definition at line 1219 of file

◆ getJedis() [2/2]

Jedis ( boolean  createNew)

Definition at line 1171 of file

◆ GetTagList()

void ( )

Asks CloudDB to retrieve all the tags belonging to this project. The resulting list is returned in the event TagList(List).

Definition at line 1058 of file

◆ GetValue()

void ( final String  tag,
final Object  valueIfTagNotThere 

GetValue asks CloudDB to get the value stored under the given tag. It will pass the result to the event. If there is no value stored under the tag, the valueIfTagNotThere{:.variable.block will be given.

tagThe tag whose value is to be retrieved.
valueIfTagNotThereThe value to pass to the event if the tag does not exist.

Definition at line 751 of file

◆ GotValue()

void ( String  tag,
Object  value 

Indicates that a GetValue(String, Object) request has succeeded.

valuethe value that was returned. Can be any type of value (e.g. number, text, boolean or list).

Definition at line 999 of file

◆ Initialize()

void ( )

Initialize: Do runtime initialization of CloudDB

Definition at line 293 of file

◆ jEval()

Object ( String  script,
String  scriptsha1,
int  argcount,
String...  args 
) throws JedisException

Definition at line 1313 of file

◆ onClear()

void ( )

◆ onDestroy()

void ( )

◆ ProjectID() [1/2]

String ( )

Gets the ProjectID for this CloudDB project.

the ProjectID for this CloudDB project

Definition at line 477 of file

◆ ProjectID() [2/2]

void ( String  id)

Specifies the ID of this CloudDB project.

idthe project ID

Definition at line 489 of file

◆ RedisPort() [1/2]

int ( )

Definition at line 466 of file

◆ RedisPort() [2/2]

void ( int  port)

Definition at line 457 of file

◆ RedisServer() [1/2]

String ( )

Definition at line 430 of file

◆ RedisServer() [2/2]

void ( String  servername)

Definition at line 405 of file

◆ RemoveFirstFromList()

void ( final String  tag)

Obtain the first element of a list and atomically remove it. If two devices use this function simultaneously, one will get the first element and the the other will get the second element, or an error if there is no available element. When the element is available, the FirstRemoved(Object) event will be triggered.

tagthe tag to pop the first value from

Definition at line 916 of file

◆ StoreValue()

void ( final String  tag,
final Object  valueToStore 

Asks CloudDB to store the given value{:.variable.block} under the given tag{:.text.block}.

tagThe tag to use
valueToStoreThe value to store. Can be any type of value (e.g. number, text, boolean or list).

Definition at line 582 of file

◆ TagList()

void ( List< String >  value)

Event triggered when we have received the list of known tags. Run in response to a call to the GetTagList() function.

valuethe list of tags that was returned.

Definition at line 1102 of file

◆ Token() [1/2]

String ( )

This field contains the authentication token used to login to the backed Redis server. For the "DEFAULT" server, do not edit this value, the system will fill it in for you. A system administrator may also provide a special value to you which can be used to share data between multiple projects from multiple people. If using your own Redis server, set a password in the server's config and enter it here.

@internaldoc Getter for the authTokenSignature.

the authTokenSignature for this CloudDB project

Definition at line 533 of file

◆ Token() [2/2]

void ( String  authToken)

Specifies the Token Signature of this CloudDB project.

authTokenfor CloudDB server

Definition at line 505 of file

◆ UseSSL() [1/2]

boolean ( )

Definition at line 556 of file

◆ UseSSL() [2/2]

void ( boolean  useSSL)

Set to true{:.logic.block} to use SSL to talk to CloudDB/Redis server. This must be set to true{:.logic.block} for the "DEFAULT" server.

useSSLtrue if a secure connection should be used for CloudDB

Definition at line 546 of file

The documentation for this class was generated from the following file: