Java Code Examples for com.google.ipc.invalidation.util.TextBuilder#append()

The following examples show how to use com.google.ipc.invalidation.util.TextBuilder#append() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonProtoStrings2.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** See spec in implementation notes. */
public static TextBuilder toCompactStringForRegistrations(TextBuilder builder,
    Collection<RegistrationP> registrations) {
  if (registrations == null) {
    return builder;
  }

  boolean first = true;
  builder.append("RegOps: ");
  for (RegistrationP registration : registrations) {
    if (!first) {
      builder.append(", ");
    }
    toCompactString(builder, registration);
    first = false;
  }
  return builder;
}
 
Example 2
Source File: AndroidStrings.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** Appends a description of the given internal {@code downcall} to the given {@code builder}. */
public static TextBuilder toCompactString(TextBuilder builder,
    InternalDowncall downcall) {
  if (downcall == null) {
    return builder;
  }
  builder.append(ProtocolIntents.INTERNAL_DOWNCALL_KEY).append("::");
  if (downcall.hasServerMessage()) {
    toCompactString(builder, downcall.getServerMessage());
  } else if (downcall.hasNetworkStatus()) {
    toCompactString(builder, downcall.getNetworkStatus());
  } else if (downcall.hasNetworkAddrChange()) {
    builder.append("newtworkAddrChange()");
  } else if (downcall.hasCreateClient()) {
    toCompactString(builder, downcall.getCreateClient());
  } else {
    builder.append(UNKNOWN_MESSAGE);
  }
  return builder;
}
 
Example 3
Source File: CommonProtoStrings2.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** See spec in implementation notes. */
public static TextBuilder toCompactString(TextBuilder builder,
    InvalidationP invalidation) {
  if (invalidation == null) {
    return builder;
  }
  builder.append("(Inv: ");
  toCompactString(builder, invalidation.getObjectId());
  builder.append(", ");
  if (invalidation.getIsTrickleRestart()) {
    builder.append("<");
  }
  builder.append(invalidation.getVersion());
  if (invalidation.hasPayload()) {
    builder.append(", P:");
    toCompactString(builder, invalidation.getPayload());
  }
  builder.append(')');
  return builder;
}
 
Example 4
Source File: AndroidService.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<ListenerUpcall:");
  if (hasSerial()) {
    builder.append(" serial=").append(serial);
  }
  builder.append(" version=").append(version);
  if (hasReady()) {
    builder.append(" ready=").append(ready);
  }
  if (invalidate != null) {
    builder.append(" invalidate=").append(invalidate);
  }
  if (registrationStatus != null) {
    builder.append(" registration_status=").append(registrationStatus);
  }
  if (registrationFailure != null) {
    builder.append(" registration_failure=").append(registrationFailure);
  }
  if (reissueRegistrations != null) {
    builder.append(" reissue_registrations=").append(reissueRegistrations);
  }
  if (error != null) {
    builder.append(" error=").append(error);
  }
  builder.append('>');
}
 
Example 5
Source File: AndroidStrings.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Appends a description of the given {@code status} upcall to the given {@code builder}. */
public static TextBuilder toCompactString(TextBuilder builder,
    RegistrationStatusUpcall status) {
  if (status == null) {
    return builder;
  }
  builder.append("registrationStatus(objectId = ");
  CommonProtoStrings2.toCompactString(builder, status.getObjectId());
  return builder.append(", isRegistered = ").append(status.getIsRegistered()).append(")");
}
 
Example 6
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<ProtocolHandlerConfigP:");
  if (hasBatchingDelayMs()) {
    builder.append(" batching_delay_ms=").append(batchingDelayMs);
  }
  builder.append(" rate_limit=[").append(rateLimit).append(']');
  builder.append('>');
}
 
Example 7
Source File: CommonProtoStrings2.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * If {@code printHighFrequencyMessages} is true, logs sub-messages that are exchanged at a high
 * frequency between the client and the registrar (if they are the only messages present),
 * e.g., invalidation message.
 */
public static TextBuilder toCompactString(TextBuilder builder,
    ServerToClientMessage msg, boolean printHighFrequencyMessages) {
  // Print the header and any sub-messages in the message.

  toCompactString(builder, msg.getHeader());
  builder.append(',');

  if (msg.hasTokenControlMessage()) {
    toCompactString(builder, msg.getTokenControlMessage());
    builder.append(',');
  }
  if (printHighFrequencyMessages && msg.hasInvalidationMessage()) {
    toCompactString(builder, msg.getInvalidationMessage());
    builder.append(',');
  }
  if (msg.hasErrorMessage()) {
    toCompactString(builder, msg.getErrorMessage());
    builder.append(',');
  }
  if (msg.hasRegistrationSyncRequestMessage()) {
    toCompactString(builder, msg.getRegistrationSyncRequestMessage());
    builder.append(',');
  }
  if (msg.hasRegistrationStatusMessage()) {
    toCompactString(builder, msg.getRegistrationStatusMessage());
    builder.append(',');
  }
  if (msg.hasInfoRequestMessage()) {
    toCompactString(builder, msg.getInfoRequestMessage());
    builder.append(',');
  }
  if (msg.hasConfigChangeMessage()) {
    toCompactString(builder, msg.getConfigChangeMessage());
    builder.append(',');
  }
  return builder;
}
 
Example 8
Source File: CommonProtoStrings2.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * If {@code printHighFrequencyMessages} is true, logs sub-messages that are exchanged at a high
 * frequency between the client and the registrar (if they are the only messages present),
 * e.g., invalidation message.
 */
public static TextBuilder toCompactString(TextBuilder builder,
    ServerToClientMessage msg, boolean printHighFrequencyMessages) {
  // Print the header and any sub-messages in the message.

  toCompactString(builder, msg.getHeader());
  builder.append(',');

  if (msg.hasTokenControlMessage()) {
    toCompactString(builder, msg.getTokenControlMessage());
    builder.append(',');
  }
  if (printHighFrequencyMessages && msg.hasInvalidationMessage()) {
    toCompactString(builder, msg.getInvalidationMessage());
    builder.append(',');
  }
  if (msg.hasErrorMessage()) {
    toCompactString(builder, msg.getErrorMessage());
    builder.append(',');
  }
  if (msg.hasRegistrationSyncRequestMessage()) {
    toCompactString(builder, msg.getRegistrationSyncRequestMessage());
    builder.append(',');
  }
  if (msg.hasRegistrationStatusMessage()) {
    toCompactString(builder, msg.getRegistrationStatusMessage());
    builder.append(',');
  }
  if (msg.hasInfoRequestMessage()) {
    toCompactString(builder, msg.getInfoRequestMessage());
    builder.append(',');
  }
  if (msg.hasConfigChangeMessage()) {
    toCompactString(builder, msg.getConfigChangeMessage());
    builder.append(',');
  }
  return builder;
}
 
Example 9
Source File: AndroidService.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<InvalidateUpcall:");
  builder.append(" ack_handle=").append(ackHandle);
  if (invalidation != null) {
    builder.append(" invalidation=").append(invalidation);
  }
  if (invalidateUnknown != null) {
    builder.append(" invalidate_unknown=").append(invalidateUnknown);
  }
  if (hasInvalidateAll()) {
    builder.append(" invalidate_all=").append(invalidateAll);
  }
  builder.append('>');
}
 
Example 10
Source File: AndroidStrings.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** Appends a description of the given {@code failure} upcall to the given {@code builder}. */
public static TextBuilder toCompactString(TextBuilder builder,
    RegistrationFailureUpcall failure) {
  if (failure == null) {
    return builder;
  }
  builder.append("registrationFailure(objectId = ");
  CommonProtoStrings2.toCompactString(builder, failure.getObjectId());
  return builder.append(", isTransient = ").append(failure.getTransient()).append(")");
}
 
Example 11
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<InitializeMessage:");
  builder.append(" client_type=").append(clientType);
  builder.append(" nonce=").append(nonce);
  builder.append(" application_client_id=").append(applicationClientId);
  builder.append(" digest_serialization_type=").append(digestSerializationType);
  builder.append('>');
}
 
Example 12
Source File: Client.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<PersistentTiclState:");
  if (hasClientToken()) {
    builder.append(" client_token=").append(clientToken);
  }
  if (hasLastMessageSendTimeMs()) {
    builder.append(" last_message_send_time_ms=").append(lastMessageSendTimeMs);
  }
  builder.append('>');
}
 
Example 13
Source File: CommonProtoStrings2.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** See spec in implementation notes. */
public static TextBuilder toCompactString(TextBuilder builder,
    RegistrationSummary regSummary) {
  if (regSummary == null) {
    return builder;
  }

  builder.appendFormat("<RegSummary: Num = %d, Hash = ", regSummary.getNumRegistrations());
  CommonProtoStrings2.toCompactString(builder, regSummary.getRegistrationDigest());
  builder.append('>');
  return builder;
}
 
Example 14
Source File: AndroidService.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<ErrorUpcall:");
  builder.append(" error_code=").append(errorCode);
  builder.append(" error_message=").append(errorMessage);
  builder.append(" is_transient=").append(isTransient);
  builder.append('>');
}
 
Example 15
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<ApplicationClientIdP:");
  if (hasClientType()) {
    builder.append(" client_type=").append(clientType);
  }
  builder.append(" client_name=").append(clientName);
  builder.append('>');
}
 
Example 16
Source File: CommonProtoStrings2.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** See spec in implementation notes. */
public static TextBuilder toCompactString(TextBuilder builder,
    RegistrationSyncRequestMessage regSyncRequestMessage) {
  if (regSyncRequestMessage == null) {
    return builder;
  }
  builder.append("RegSyncRequestMsg: ");
  return builder;
}
 
Example 17
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<StatusP:");
  builder.append(" code=").append(code);
  if (hasDescription()) {
    builder.append(" description=").append(description);
  }
  builder.append('>');
}
 
Example 18
Source File: AndroidService.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<RegistrationDowncall:");
  builder.append(" registrations=[").append(registrations).append(']');
  builder.append(" unregistrations=[").append(unregistrations).append(']');
  builder.append('>');
}
 
Example 19
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<RegistrationSyncMessage:");
  builder.append(" subtree=[").append(subtree).append(']');
  builder.append('>');
}
 
Example 20
Source File: AndroidService.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override public void toCompactString(TextBuilder builder) {
  builder.append("<ReissueRegistrationsUpcall:");
  builder.append(" prefix=").append(prefix);
  builder.append(" length=").append(length);
  builder.append('>');
}