AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.CloudDB Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.CloudDB:
com.google.appinventor.components.runtime.AndroidNonvisibleComponent com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.OnClearListener com.google.appinventor.components.runtime.OnDestroyListener com.google.appinventor.components.runtime.Component

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 com.google.appinventor.components.runtime.AndroidNonvisibleComponent
HandlesEventDispatching getDispatchDelegate ()
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
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 ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
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_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
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
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
 AndroidNonvisibleComponent (Form form)
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
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
manti.nosp@m.ng@m.nosp@m.it.ed.nosp@m.u (Natalie Lao)
joymi.nosp@m.tro1.nosp@m.989@g.nosp@m.mail.nosp@m..com (Joydeep Mitra)
jis@m.nosp@m.it.e.nosp@m.du (Jeffrey I. Schiller)

Definition at line 110 of file CloudDB.java.

Constructor & Destructor Documentation

◆ CloudDB()

com.google.appinventor.components.runtime.CloudDB.CloudDB ( ComponentContainer  container)

Creates a new CloudDB component.

Parameters
containerthe Form that this component is contained in.

Definition at line 274 of file CloudDB.java.

Member Function Documentation

◆ AppendValueToList()

void com.google.appinventor.components.runtime.CloudDB.AppendValueToList ( final String  tag,
final Object  itemToAdd 
)

Definition at line 964 of file CloudDB.java.

◆ ClearTag()

void com.google.appinventor.components.runtime.CloudDB.ClearTag ( final String  tag)

Remove the tag from CloudDB.

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

Parameters
tagThe tag to remove

Definition at line 1036 of file CloudDB.java.

◆ CloudConnected()

boolean com.google.appinventor.components.runtime.CloudDB.CloudConnected ( )

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

Returns
true if the network is connected, otherwise false

Definition at line 844 of file CloudDB.java.

◆ CloudDBError()

void com.google.appinventor.components.runtime.CloudDB.CloudDBError ( final String  message)

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

Parameters
messagethe error message

Definition at line 1141 of file CloudDB.java.

◆ DataChanged()

void com.google.appinventor.components.runtime.CloudDB.DataChanged ( 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.

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

Definition at line 1115 of file CloudDB.java.

◆ DefaultRedisServer()

void com.google.appinventor.components.runtime.CloudDB.DefaultRedisServer ( String  server)

Definition at line 448 of file CloudDB.java.

◆ FirstRemoved()

void com.google.appinventor.components.runtime.CloudDB.FirstRemoved ( 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.

Parameters
valuethe value removed from the beginning of the list

Definition at line 860 of file CloudDB.java.

◆ getBackground()

ExecutorService com.google.appinventor.components.runtime.CloudDB.getBackground ( )

Definition at line 1309 of file CloudDB.java.

◆ getForm()

Form com.google.appinventor.components.runtime.CloudDB.getForm ( )

Definition at line 1167 of file CloudDB.java.

◆ getJedis() [1/2]

synchronized Jedis com.google.appinventor.components.runtime.CloudDB.getJedis ( )

Definition at line 1219 of file CloudDB.java.

◆ getJedis() [2/2]

Jedis com.google.appinventor.components.runtime.CloudDB.getJedis ( boolean  createNew)

Definition at line 1171 of file CloudDB.java.

◆ GetTagList()

void com.google.appinventor.components.runtime.CloudDB.GetTagList ( )

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 CloudDB.java.

◆ GetValue()

void com.google.appinventor.components.runtime.CloudDB.GetValue ( 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.

Parameters
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 CloudDB.java.

◆ GotValue()

void com.google.appinventor.components.runtime.CloudDB.GotValue ( String  tag,
Object  value 
)

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

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

Definition at line 999 of file CloudDB.java.

◆ Initialize()

void com.google.appinventor.components.runtime.CloudDB.Initialize ( )

Initialize: Do runtime initialization of CloudDB

Definition at line 293 of file CloudDB.java.

◆ jEval()

Object com.google.appinventor.components.runtime.CloudDB.jEval ( String  script,
String  scriptsha1,
int  argcount,
String...  args 
) throws JedisException

Definition at line 1313 of file CloudDB.java.

◆ onClear()

void com.google.appinventor.components.runtime.CloudDB.onClear ( )

◆ onDestroy()

void com.google.appinventor.components.runtime.CloudDB.onDestroy ( )

◆ ProjectID() [1/2]

String com.google.appinventor.components.runtime.CloudDB.ProjectID ( )

Gets the ProjectID for this CloudDB project.

Returns
the ProjectID for this CloudDB project

Definition at line 477 of file CloudDB.java.

◆ ProjectID() [2/2]

void com.google.appinventor.components.runtime.CloudDB.ProjectID ( String  id)

Specifies the ID of this CloudDB project.

Parameters
idthe project ID

Definition at line 489 of file CloudDB.java.

◆ RedisPort() [1/2]

int com.google.appinventor.components.runtime.CloudDB.RedisPort ( )

Definition at line 466 of file CloudDB.java.

◆ RedisPort() [2/2]

void com.google.appinventor.components.runtime.CloudDB.RedisPort ( int  port)

Definition at line 457 of file CloudDB.java.

◆ RedisServer() [1/2]

String com.google.appinventor.components.runtime.CloudDB.RedisServer ( )

Definition at line 430 of file CloudDB.java.

◆ RedisServer() [2/2]

void com.google.appinventor.components.runtime.CloudDB.RedisServer ( String  servername)

Definition at line 405 of file CloudDB.java.

◆ RemoveFirstFromList()

void com.google.appinventor.components.runtime.CloudDB.RemoveFirstFromList ( 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.

Parameters
tagthe tag to pop the first value from

Definition at line 916 of file CloudDB.java.

◆ StoreValue()

void com.google.appinventor.components.runtime.CloudDB.StoreValue ( final String  tag,
final Object  valueToStore 
)

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

Parameters
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 CloudDB.java.

◆ TagList()

void com.google.appinventor.components.runtime.CloudDB.TagList ( List< String >  value)

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

Parameters
valuethe list of tags that was returned.

Definition at line 1102 of file CloudDB.java.

◆ Token() [1/2]

String com.google.appinventor.components.runtime.CloudDB.Token ( )

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.

Returns
the authTokenSignature for this CloudDB project

Definition at line 533 of file CloudDB.java.

◆ Token() [2/2]

void com.google.appinventor.components.runtime.CloudDB.Token ( String  authToken)

Specifies the Token Signature of this CloudDB project.

Parameters
authTokenfor CloudDB server

Definition at line 505 of file CloudDB.java.

◆ UseSSL() [1/2]

boolean com.google.appinventor.components.runtime.CloudDB.UseSSL ( )

Definition at line 556 of file CloudDB.java.

◆ UseSSL() [2/2]

void com.google.appinventor.components.runtime.CloudDB.UseSSL ( 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.

Parameters
useSSLtrue if a secure connection should be used for CloudDB

Definition at line 546 of file CloudDB.java.


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