• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ObjectId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.ipc.invalidation.external.client.types.ObjectId的典型用法代码示例。如果您正苦于以下问题:Java ObjectId类的具体用法?Java ObjectId怎么用?Java ObjectId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectId类属于com.google.ipc.invalidation.external.client.types包,在下文中一共展示了ObjectId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSavedObjectIds

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Returns the saved non-sync object ids, or {@code null} if none exist. */
@Nullable
public Set<ObjectId> getSavedObjectIds() {
    SharedPreferences preferences = ContextUtils.getAppSharedPreferences();
    Set<String> objectIdStrings = preferences.getStringSet(PrefKeys.TANGO_OBJECT_IDS, null);
    if (objectIdStrings == null) {
        return null;
    }
    Set<ObjectId> objectIds = new HashSet<ObjectId>(objectIdStrings.size());
    for (String objectIdString : objectIdStrings) {
        ObjectId objectId = getObjectId(objectIdString);
        if (objectId != null) {
            objectIds.add(objectId);
        }
    }
    return objectIds;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:InvalidationPreferences.java


示例2: getObjectId

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/**
 * Converts the given object id string stored in preferences to an object id.
 * Returns null if the string does not represent a valid object id.
 */
private ObjectId getObjectId(String objectIdString) {
    int separatorPos = objectIdString.indexOf(':');
    // Ensure that the separator is surrounded by at least one character on each side.
    if (separatorPos < 1 || separatorPos == objectIdString.length() - 1) {
        return null;
    }
    int objectSource;
    try {
        objectSource = Integer.parseInt(objectIdString.substring(0, separatorPos));
    } catch (NumberFormatException e) {
        return null;
    }
    byte[] objectName = objectIdString.substring(separatorPos + 1).getBytes();
    return ObjectId.newInstance(objectSource, objectName);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:20,代码来源:InvalidationPreferences.java


示例3: getRegisteredObjectIds

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Returns the object ids for which to register contained in the intent. */
public static Set<ObjectId> getRegisteredObjectIds(Intent intent) {
    ArrayList<Integer> objectSources =
            intent.getIntegerArrayListExtra(EXTRA_REGISTERED_OBJECT_SOURCES);
    ArrayList<String> objectNames =
            intent.getStringArrayListExtra(EXTRA_REGISTERED_OBJECT_NAMES);
    if (objectSources == null || objectNames == null
            || objectSources.size() != objectNames.size()) {
        return null;
    }
    Set<ObjectId> objectIds = new HashSet<ObjectId>(objectSources.size());
    for (int i = 0; i < objectSources.size(); i++) {
        objectIds.add(
                ObjectId.newInstance(objectSources.get(i), objectNames.get(i).getBytes()));
    }
    return objectIds;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:InvalidationIntentProtocol.java


示例4: informRegistrationFailure

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void informRegistrationFailure(
        byte[] clientId, ObjectId objectId, boolean isTransient, String errorMessage) {
    Log.w(TAG, "Registration failure on " + objectId + " ; transient = " + isTransient
            + ": " + errorMessage);
    if (isTransient) {
      // Retry immediately on transient failures. The base AndroidListener will handle
      // exponential backoff if there are repeated failures.
        List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
        if (readRegistrationsFromPrefs().contains(objectId)) {
            register(clientId, objectIdAsList);
        } else {
            unregister(clientId, objectIdAsList);
        }
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:17,代码来源:InvalidationClientService.java


示例5: informRegistrationStatus

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void informRegistrationStatus(
        byte[] clientId, ObjectId objectId, RegistrationState regState) {
    Log.d(TAG, "Registration status for " + objectId + ": " + regState);
    List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
    boolean registrationisDesired = readRegistrationsFromPrefs().contains(objectId);
    if (regState == RegistrationState.REGISTERED) {
        if (!registrationisDesired) {
            Log.i(TAG, "Unregistering for object we're no longer interested in");
            unregister(clientId, objectIdAsList);
        }
    } else {
        if (registrationisDesired) {
            Log.i(TAG, "Registering for an object");
            register(clientId, objectIdAsList);
        }
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:InvalidationClientService.java


示例6: AndroidListenerState

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Initializes state from proto. */
AndroidListenerState(int initialMaxDelayMs, int maxDelayFactor,
    AndroidListenerProtocol.AndroidListenerState state) {
  desiredRegistrations = new HashSet<ObjectId>();
  for (ObjectIdP objectIdProto : state.getRegistration()) {
    desiredRegistrations.add(ProtoWrapperConverter.convertFromObjectIdProto(objectIdProto));
  }
  for (RetryRegistrationState retryState : state.getRetryRegistrationState()) {
    ObjectIdP objectIdP = retryState.getNullableObjectId();
    if (objectIdP == null) {
      continue;
    }
    ObjectId objectId = ProtoWrapperConverter.convertFromObjectIdProto(objectIdP);
    delayGenerators.put(objectId, new TiclExponentialBackoffDelayGenerator(random,
        initialMaxDelayMs, maxDelayFactor, retryState.getExponentialBackoffState()));
  }
  for (ScheduledRegistrationRetry registrationRetry : state.getRegistrationRetry()) {
    registrationRetries.put(registrationRetry.getExecuteTimeMs(), registrationRetry.getCommand());
  }
  clientId = state.getClientId();
  requestCodeSeqNum = state.getRequestCodeSeqNum();
  isDirty = false;
  this.initialMaxDelayMs = initialMaxDelayMs;
  this.maxDelayFactor = maxDelayFactor;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:26,代码来源:AndroidListenerState.java


示例7: informRegistrationStatus

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void informRegistrationStatus(byte[] clientId, ObjectId objectId,
    RegistrationState regState) {
  Log.i(TAG, "informRegistrationStatus");

  List<ObjectId> objectIds = new ArrayList<ObjectId>();
  objectIds.add(objectId);
  if (regState == RegistrationState.REGISTERED) {
    if (!interestingObjects.contains(objectId)) {
      Log.i(TAG, "Unregistering for object we're no longer interested in");
      unregister(clientId, objectIds);
    }
  } else {
    if (interestingObjects.contains(objectId)) {
      Log.i(TAG, "Registering for an object");
      register(clientId, objectIds);
    }
  }
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:20,代码来源:ExampleListener.java


示例8: informRegistrationFailure

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void informRegistrationFailure(
        byte[] clientId, ObjectId objectId, boolean isTransient, String errorMessage) {
    Log.w(TAG, "Registration failure on " + objectId + " ; transient = " + isTransient
            + ": " + errorMessage);
    if (isTransient) {
      // Retry immediately on transient failures. The base AndroidListener will handle
      // exponential backoff if there are repeated failures.
      List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
      if (readRegistrationsFromPrefs().contains(objectId)) {
          register(clientId, objectIdAsList);
      } else {
          unregister(clientId, objectIdAsList);
      }
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:17,代码来源:InvalidationService.java


示例9: informRegistrationStatus

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void informRegistrationStatus(
        byte[] clientId, ObjectId objectId, RegistrationState regState) {
    Log.d(TAG, "Registration status for " + objectId + ": " + regState);
    List<ObjectId> objectIdAsList = CollectionUtil.newArrayList(objectId);
    boolean registrationisDesired = readRegistrationsFromPrefs().contains(objectId);
    if (regState == RegistrationState.REGISTERED) {
      if (!registrationisDesired) {
        Log.i(TAG, "Unregistering for object we're no longer interested in");
        unregister(clientId, objectIdAsList);
      }
    } else {
      if (registrationisDesired) {
        Log.i(TAG, "Registering for an object");
        register(clientId, objectIdAsList);
      }
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:InvalidationService.java


示例10: issueDelayedRegistrationIntent

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Issues a registration retry with delay. */
static void issueDelayedRegistrationIntent(Context context, AndroidClock clock,
    ByteString clientId, ObjectId objectId, boolean isRegister, int delayMs, int requestCode) {
  RegistrationCommand command = isRegister ?
      AndroidListenerProtos.newDelayedRegisterCommand(clientId, objectId) :
          AndroidListenerProtos.newDelayedUnregisterCommand(clientId, objectId);
  Intent intent = new Intent()
      .putExtra(EXTRA_REGISTRATION, command.toByteArray())
      .setClass(context, AlarmReceiver.class);

  // Create a pending intent that will cause the AlarmManager to fire the above intent.
  PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent,
      PendingIntent.FLAG_ONE_SHOT);

  // Schedule the pending intent after the appropriate delay.
  AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
  long executeMs = clock.nowMs() + delayMs;
  alarmManager.set(AlarmManager.RTC, executeMs, pendingIntent);
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:20,代码来源:AndroidListenerIntents.java


示例11: requestSync

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/**
 * Requests that the sync system perform a sync.
 *
 * @param objectId the object that changed, if known.
 * @param version the version of the object that changed, if known.
 * @param payload the payload of the change, if known.
 */
private void requestSync(@Nullable ObjectId objectId, @Nullable Long version,
        @Nullable String payload) {
    // Construct the bundle to supply to the native sync code.
    Bundle bundle = new Bundle();
    if (objectId == null && version == null && payload == null) {
        // Use an empty bundle in this case for compatibility with the v1 implementation.
    } else {
        if (objectId != null) {
            bundle.putInt("objectSource", objectId.getSource());
            bundle.putString("objectId", new String(objectId.getName()));
        }
        // We use "0" as the version if we have an unknown-version invalidation. This is OK
        // because the native sync code special-cases zero and always syncs for invalidations at
        // that version (Tango defines a special UNKNOWN_VERSION constant with this value).
        bundle.putLong("version", (version == null) ? 0 : version);
        bundle.putString("payload", (payload == null) ? "" : payload);
    }
    Account account = ChromeSigninController.get(this).getSignedInUser();
    String contractAuthority = SyncStatusHelper.get(this).getContractAuthority();
    requestSyncFromContentResolver(bundle, account, contractAuthority);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:29,代码来源:InvalidationService.java


示例12: getSavedObjectIds

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Returns the saved non-sync object ids, or {@code null} if none exist. */
@Nullable
public Set<ObjectId> getSavedObjectIds() {
  SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
  Set<String> objectIdStrings = preferences.getStringSet(PrefKeys.TANGO_OBJECT_IDS, null);
  if (objectIdStrings == null) {
      return null;
  }
  Set<ObjectId> objectIds = new HashSet<ObjectId>(objectIdStrings.size());
  for (String objectIdString : objectIdStrings) {
      ObjectId objectId = getObjectId(objectIdString);
      if (objectId != null) {
          objectIds.add(objectId);
      }
  }
  return objectIds;
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:18,代码来源:InvalidationPreferences.java


示例13: informRegistrationFailure

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void informRegistrationFailure(byte[] clientId, ObjectId objectId, boolean isTransient,
    String errorMessage) {
  Log.e(TAG, "Registration failure!");
  if (isTransient) {
    // Retry immediately on transient failures. The base AndroidListener will handle exponential
    // backoff if there are repeated failures.
    List<ObjectId> objectIds = new ArrayList<ObjectId>();
    objectIds.add(objectId);
    if (interestingObjects.contains(objectId)) {
      Log.i(TAG, "Retrying registration of " + objectId);
      register(clientId, objectIds);
    } else {
      Log.i(TAG, "Retrying unregistration of " + objectId);
      unregister(clientId, objectIds);
    }
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:ExampleListener.java


示例14: refreshData

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Updates UI with current registration status and object versions. */
private static void refreshData() {
  final MainActivity activity = State.currentActivity;
  if (null != activity) {
    final StringBuilder builder = new StringBuilder();
    builder.append("\nLast informed versions status\n");
    builder.append("--begin-------------\n");
    synchronized (State.lastInformedVersion) {
      for (Entry<ObjectId, String> entry : State.lastInformedVersion.entrySet()) {
        builder.append(entry.getKey().toString()).append(" -> ").append(entry.getValue())
            .append("\n");
      }
    }
    builder.append("--end---------------\n");
    activity.info.post(new Runnable() {
      @Override
      public void run() {
        activity.info.setText(builder.toString());
      }
    });
  }
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:23,代码来源:MainActivity.java


示例15: handleIncomingHeader

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Handles a server {@code header}. */
private void handleIncomingHeader(ServerMessageHeader header) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
  Preconditions.checkState(nonce == null,
      "Cannot process server header with non-null nonce (have %s): %s", nonce, header);
  if (header.registrationSummary != null) {
    // We've received a summary from the server, so if we were suppressing
    // registrations, we should now allow them to go to the registrar.
    shouldSendRegistrations = true;

    // Pass the registration summary to the registration manager. If we are now in agreement
    // with the server and we had any pending operations, we can tell the listener that those
    // operations have succeeded.
    Set<ProtoWrapper<RegistrationP>> upcalls =
        registrationManager.informServerRegistrationSummary(header.registrationSummary);
    logger.fine("Receivced new server registration summary (%s); will make %s upcalls",
        header.registrationSummary, upcalls.size());
    for (ProtoWrapper<RegistrationP> upcall : upcalls) {
      RegistrationP registration = upcall.getProto();
      ObjectId objectId = ProtoConverter.convertFromObjectIdProto(registration.getObjectId());
      RegistrationState regState = convertOpTypeToRegState(registration.getOpType());
      listener.informRegistrationStatus(this, objectId, regState);
    }
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:InvalidationClientCore.java


示例16: getRegisteredObjectIds

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Returns the object ids for which to register contained in the intent. */
public static Set<ObjectId> getRegisteredObjectIds(Intent intent) {
    ArrayList<Integer> objectSources =
            intent.getIntegerArrayListExtra(EXTRA_REGISTERED_OBJECT_SOURCES);
    ArrayList<String> objectNames =
            intent.getStringArrayListExtra(EXTRA_REGISTERED_OBJECT_NAMES);
    if (objectSources == null || objectNames == null ||
            objectSources.size() != objectNames.size()) {
        return null;
    }
    Set<ObjectId> objectIds = new HashSet<ObjectId>(objectSources.size());
    for (int i = 0; i < objectSources.size(); i++) {
        objectIds.add(ObjectId.newInstance(
                objectSources.get(i), objectNames.get(i).getBytes()));
    }
    return objectIds;
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:18,代码来源:InvalidationIntentProtocol.java


示例17: AndroidListenerState

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Initializes state from proto. */
AndroidListenerState(int initialMaxDelayMs, int maxDelayFactor,
    AndroidListenerProtocol.AndroidListenerState state) {
  desiredRegistrations = new HashSet<ObjectId>();
  for (ObjectIdP objectIdProto : state.getRegistrationList()) {
    desiredRegistrations.add(ProtoConverter.convertFromObjectIdProto(objectIdProto));
  }
  for (RetryRegistrationState retryState : state.getRetryRegistrationStateList()) {
    ObjectId objectId = ProtoConverter.convertFromObjectIdProto(retryState.getObjectId());
    delayGenerators.put(objectId, new TiclExponentialBackoffDelayGenerator(random,
        initialMaxDelayMs, maxDelayFactor, retryState.getExponentialBackoffState()));
  }
  clientId = state.getClientId();
  requestCodeSeqNum = state.getRequestCodeSeqNum();
  isDirty = false;
  this.initialMaxDelayMs = initialMaxDelayMs;
  this.maxDelayFactor = maxDelayFactor;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:AndroidListenerState.java


示例18: notificationTypesToObjectIds

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/**
 * Converts a set of {@link String} notification types to a set of {@link ObjectId}.
 *
 * This function assumes that all the strings passed in were generated with
 * ModelTypeHelper.toNotificationType. Any notification types that are nonInvalidationTypes
 * are filtered out.
 */
public static Set<ObjectId> notificationTypesToObjectIds(Collection<String> notificationTypes) {
    Set<ObjectId> objectIds = new HashSet<ObjectId>();
    for (String notificationType : notificationTypes) {
        if (isInvalidationType(notificationType)) {
            objectIds.add(toObjectId(notificationType));
        }
    }
    return objectIds;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:17,代码来源:ModelTypeHelper.java


示例19: setObjectIds

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
/** Sets the saved non-sync object ids */
public void setObjectIds(EditContext editContext, Collection<ObjectId> objectIds) {
    if (objectIds == null) throw new NullPointerException("objectIds is null.");
    Set<String> objectIdStrings = new HashSet<String>(objectIds.size());
    for (ObjectId objectId : objectIds) {
        objectIdStrings.add(getObjectIdString(objectId));
    }
    editContext.mEditor.putStringSet(PrefKeys.TANGO_OBJECT_IDS, objectIdStrings);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:InvalidationPreferences.java


示例20: reissueRegistrations

import com.google.ipc.invalidation.external.client.types.ObjectId; //导入依赖的package包/类
@Override
public void reissueRegistrations(byte[] clientId) {
    Set<ObjectId> desiredRegistrations = readRegistrationsFromPrefs();
    if (!desiredRegistrations.isEmpty()) {
        register(clientId, desiredRegistrations);
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:8,代码来源:InvalidationClientService.java



注:本文中的com.google.ipc.invalidation.external.client.types.ObjectId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultAxisValueFormatter类代码示例发布时间:2022-05-22
下一篇:
Java EntityCow类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap