本文整理汇总了Java中co.realtime.storage.StorageRef类的典型用法代码示例。如果您正苦于以下问题:Java StorageRef类的具体用法?Java StorageRef怎么用?Java StorageRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StorageRef类属于co.realtime.storage包,在下文中一共展示了StorageRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareClient
import co.realtime.storage.StorageRef; //导入依赖的package包/类
public static void prepareClient(Context context, InterfaceRefresher rootView){
selfHandler = new StorageHandler();
selfHandler.context = context;
selfHandler.rootView = rootView;
selfHandler.messages = new HashMap<String, Channel>();
try {
storageRef = new StorageRef(Config.APPKEY, Config.TOKEN, Config.PROJECT_ID, context);
ArrayList<String> channels = PreferencesManager.getInstance(selfHandler.context).loadChannels();
for (String channel : channels) {
addChannel(channel);
}
StorageHandler.selfHandler.isConnected = true;
StorageHandler.selfHandler.rootView.refreshData(null);
} catch (StorageException e) {
e.printStackTrace();
}
}
示例2: convertProvisionType
import co.realtime.storage.StorageRef; //导入依赖的package包/类
private StorageRef.StorageProvisionType convertProvisionType(String ProvisionTypeString)
{
try {
HashMap<String, StorageRef.StorageProvisionType> enu = new HashMap();
enu.put("ProvisionType_LIGHT", StorageRef.StorageProvisionType.LIGHT);
enu.put("ProvisionType_MEDIUM", StorageRef.StorageProvisionType.MEDIUM);
enu.put("ProvisionType_INTERMEDIATE", StorageRef.StorageProvisionType.INTERMEDIATE);
enu.put("ProvisionType_HEAVY", StorageRef.StorageProvisionType.HEAVY);
enu.put("ProvisionType_CUSTOM", StorageRef.StorageProvisionType.CUSTOM);
StorageRef.StorageProvisionType res = enu.get(ProvisionTypeString);
return res;
}catch (NullPointerException e){
return null;
}
}
示例3: once
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void once(final String eventType, final Integer sId, final String table){
StorageRef.StorageEvent event = convertStorageEvent(eventType);
TableRef tableRef = _tableRefs.get(sId).get(table);
tableRef.once(event, new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
sendEvent(getReactApplicationContext(), table + "-once-" + eventType, convertlinkedMap(itemSnapshot.val()));
}
}, new OnError() {
@Override
public void run(Integer integer, String s) {
WritableNativeMap map = new WritableNativeMap();
map.putString("error", s);
sendEvent(getReactApplicationContext(), table + "-once-" + eventType, map);
}
});
}
示例4: onceCustom
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void onceCustom(final String eventType, String aPrimaryKeyValue, final Integer sId, final String table){
StorageRef.StorageEvent event = convertStorageEvent(eventType);
TableRef tableRef = _tableRefs.get(sId).get(table);
tableRef.once(event, new ItemAttribute(aPrimaryKeyValue), new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
sendEvent(getReactApplicationContext(), table + "-once-" + eventType, convertlinkedMap(itemSnapshot.val()));
}
}, new OnError() {
@Override
public void run(Integer integer, String s) {
WritableNativeMap map = new WritableNativeMap();
map.putString("error", s);
sendEvent(getReactApplicationContext(), table + "-once-" + eventType, map);
}
});
}
示例5: convertProvisionLoad
import co.realtime.storage.StorageRef; //导入依赖的package包/类
private StorageRef.StorageProvisionLoad convertProvisionLoad(String ProvisionLoadString)
{
try {
HashMap<String, StorageRef.StorageProvisionLoad> enu = new HashMap();
enu.put("ProvisionLoad_READ", StorageRef.StorageProvisionLoad.READ);
enu.put("ProvisionLoad_WRITE", StorageRef.StorageProvisionLoad.WRITE);
enu.put("ProvisionLoad_BALANCED", StorageRef.StorageProvisionLoad.BALANCED);
StorageRef.StorageProvisionLoad res = enu.get(ProvisionLoadString);
return res;
}catch (NullPointerException e){
return null;
}
}
示例6: convertStorageDataType
import co.realtime.storage.StorageRef; //导入依赖的package包/类
private StorageRef.StorageDataType convertStorageDataType(String StorageDataTypeString)
{
try {
HashMap<String, StorageRef.StorageDataType> enu = new HashMap();
enu.put("StorageDataType_STRING", StorageRef.StorageDataType.STRING);
enu.put("StorageDataType_NUMBER", StorageRef.StorageDataType.NUMBER);
StorageRef.StorageDataType res = enu.get(StorageDataTypeString);
return res;
}catch (NullPointerException e){
return null;
}
}
示例7: convertStorageEvent
import co.realtime.storage.StorageRef; //导入依赖的package包/类
private StorageRef.StorageEvent convertStorageEvent(String StorageEventString)
{
try {
HashMap<String, StorageRef.StorageEvent> enu = new HashMap();
enu.put("StorageEvent_PUT", StorageRef.StorageEvent.PUT);
enu.put("StorageEvent_UPDATE", StorageRef.StorageEvent.UPDATE);
enu.put("StorageEvent_DELETE", StorageRef.StorageEvent.DELETE);
StorageRef.StorageEvent res = enu.get(StorageEventString);
return res;
}catch (NullPointerException e){
return null;
}
}
示例8: table
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void table(String tableName, Integer sId, String tId){
StorageRef storageRef = _storagerefs.get(sId);
if (storageRef == null)
return;
TableRef tableRef;
try{
tableRef = storageRef.table(tableName);
appendTable(tableRef, sId, tId);
}catch (NullPointerException e){
return;
}
}
示例9: activateOfflineBuffering
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void activateOfflineBuffering(final Integer sId){
StorageRef storageRef = _storagerefs.get(sId);
if (storageRef == null)
return;
storageRef.activateOfflineBuffering();
}
示例10: deactivateOfflineBuffering
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void deactivateOfflineBuffering(final Integer sId){
StorageRef storageRef = _storagerefs.get(sId);
if (storageRef == null)
return;
storageRef.deactivateOfflineBuffering();
}
示例11: on
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void on(final String eventType, final Integer sId, final String table){
StorageRef.StorageEvent event = convertStorageEvent(eventType);
TableRef tableRef = _tableRefs.get(sId).get(table);
tableRef.on(event, new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
sendEvent(getReactApplicationContext(), table + "-on-" + eventType, convertlinkedMap(itemSnapshot.val()));
}
});
}
示例12: onCustom
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void onCustom(final String eventType, String aPrimaryKeyValue, final Integer sId, final String table){
StorageRef.StorageEvent event = convertStorageEvent(eventType);
TableRef tableRef = _tableRefs.get(sId).get(table);
tableRef.on(event, new ItemAttribute(aPrimaryKeyValue), new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
sendEvent(getReactApplicationContext(), table + "-on-" + eventType, convertlinkedMap(itemSnapshot.val()));
}
});
}
示例13: off
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void off(final String eventType, final Integer sId, String table){
StorageRef.StorageEvent event = convertStorageEvent(eventType);
TableRef tableRef = _tableRefs.get(sId).get(table);
tableRef.off(event, new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
}
});
}
示例14: offCustom
import co.realtime.storage.StorageRef; //导入依赖的package包/类
@ReactMethod
public void offCustom(final String eventType, String aPrimaryKeyValue, final Integer sId, String table){
StorageRef.StorageEvent event = convertStorageEvent(eventType);
TableRef tableRef = _tableRefs.get(sId).get(table);
tableRef.off(event, new ItemAttribute(aPrimaryKeyValue), new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
}
});
}
示例15: Player
import co.realtime.storage.StorageRef; //导入依赖的package包/类
public Player(StorageRef storage, String _gameID, String _playerID, String _name, int _score) {
gameID= _gameID;
playerID = _playerID;
name = _name;
score = _score;
gameTableRef = storage.table("Game").equals("gameID", new ItemAttribute(gameID));
}