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

Java Action类代码示例

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

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



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

示例1: initialize

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
/**
 * Called to initialize a newly created client instance with the invalidation service.
 */
void initialize() {
  // Create an intent that can be used to fire listener events back to the
  // provided listener service. Use setComponent and not setPackage/setClass so the
  // intent is guaranteed to be valid even if the service is not in the same application
  Intent eventIntent = new Intent(Event.LISTENER_INTENT);
  ComponentName component = new ComponentName(context.getPackageName(), listenerClass.getName());
  eventIntent.setComponent(component);

  Request request = Request
      .newBuilder(Action.CREATE)
      .setClientKey(clientKey)
      .setClientType(clientType)
      .setAccount(account)
      .setAuthType(authType)
      .setIntent(eventIntent)
      .build();
  executeServiceRequest(request);
  addReference();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:23,代码来源:AndroidInvalidationClientImpl.java


示例2: create

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void create(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(request, Action.CREATE, Parameter.ACTION, Parameter.CLIENT,
        Parameter.CLIENT_TYPE, Parameter.ACCOUNT, Parameter.AUTH_TYPE, Parameter.INTENT);
    logger.info("Creating client %s:%s", request.getClientKey(), clientMap.keySet());
    if (!TypedUtil.containsKey(clientMap, request.getClientKey())) {
      // If no client exists with this key, create one.
      clientMap.put(
          request.getClientKey(), new ClientState(request.getAccount(), request.getAuthType(),
              request.getIntent()));
    } else {
      // Otherwise, verify that the existing client has the same account / auth type / intent.
      ClientState existingState = TypedUtil.mapGet(clientMap, request.getClientKey());
      Preconditions.checkState(request.getAccount().equals(existingState.account));
      Preconditions.checkState(request.getAuthType().equals(existingState.authType));
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:InvalidationTestService.java


示例3: resume

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void resume(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(
        request, Action.RESUME, Parameter.ACTION, Parameter.CLIENT);
    ClientState state = clientMap.get(request.getClientKey());
    if (state != null) {
      logger.info("Resuming client %s:%s", request.getClientKey(), clientMap.keySet());
      response.setStatus(Response.Status.SUCCESS);
      response.setAccount(state.account);
      response.setAuthType(state.authType);
    } else {
      logger.warning("Cannot resume client %s:%s", request.getClientKey(), clientMap.keySet());
      response.setStatus(Response.Status.INVALID_CLIENT);
    }
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:InvalidationTestService.java


示例4: unregister

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void unregister(Request request, Response.Builder response) {
  synchronized (LOCK) {
    // Ensure that one (and only one) of the variant object id forms is used
    String objectParam =
      request.getBundle().containsKey(Parameter.OBJECT_ID) ?
          Parameter.OBJECT_ID :
          Parameter.OBJECT_ID_LIST;
    validateRequest(request, Action.UNREGISTER, Parameter.ACTION,
        Parameter.CLIENT, objectParam);
    if (!validateClient(request)) {
      response.setStatus(Response.Status.INVALID_CLIENT);
      return;
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:18,代码来源:InvalidationTestService.java


示例5: register

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
/**
 * Registers to receive invalidation notifications for an object.
 *
 * @param objectId object id.
 */
@Override
public void register(ObjectId objectId) {
  Request request =
      Request.newBuilder(Action.REGISTER).setClientKey(clientKey).setObjectId(objectId).build();
  executeServiceRequest(request);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidInvalidationClientImpl.java


示例6: unregister

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
/**
 * Unregisters to disable receipt of invalidations on an object.
 *
 * @param objectId object id.
 */
@Override
public void unregister(ObjectId objectId) {
  Request request =
      Request.newBuilder(Action.UNREGISTER).setClientKey(clientKey).setObjectId(objectId).build();
  executeServiceRequest(request);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:AndroidInvalidationClientImpl.java


示例7: acknowledge

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
public void acknowledge(AckHandle ackHandle) {
  Request request = Request
      .newBuilder(Action.ACKNOWLEDGE)
      .setClientKey(clientKey)
      .setAckHandle(ackHandle)
      .build();
  executeServiceRequest(request);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidInvalidationClientImpl.java


示例8: destroy

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
public void destroy() {
  Request request = Request
      .newBuilder(Action.DESTROY)
      .setClientKey(clientKey)
      .build();
  executeServiceRequest(request);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:AndroidInvalidationClientImpl.java


示例9: initResumed

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
/**
 * Called to resume an existing client instance with the invalidation service. Iff
 * {@code sendTiclResumeRequest}, a request is sent to the invalidatation service to ensure
 * that the Ticl is loaded.
 */
void initResumed(boolean sendTiclResumeRequest) {
  if (sendTiclResumeRequest) {
    Request request = Request.newBuilder(Action.RESUME).setClientKey(clientKey).build();
    executeServiceRequest(request);
  }
  addReference();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:AndroidInvalidationClientImpl.java


示例10: register

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void register(Request request, Response.Builder response) {
  synchronized (LOCK) {
    // Ensure that one (and only one) of the variant object id forms is used
    String objectParam =
      request.getBundle().containsKey(Parameter.OBJECT_ID) ?
          Parameter.OBJECT_ID : Parameter.OBJECT_ID_LIST;
    validateRequest(request, Action.REGISTER, Parameter.ACTION, Parameter.CLIENT, objectParam);
    if (!validateClient(request)) {
      response.setStatus(Response.Status.INVALID_CLIENT);
      return;
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:16,代码来源:InvalidationTestService.java


示例11: start

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void start(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(
        request, Action.START, Parameter.ACTION, Parameter.CLIENT);
    if (!validateClient(request)) {
      response.setStatus(Response.Status.INVALID_CLIENT);
      return;
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:InvalidationTestService.java


示例12: stop

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void stop(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(request, Action.STOP, Parameter.ACTION, Parameter.CLIENT);
    if (!validateClient(request)) {
      response.setStatus(Response.Status.INVALID_CLIENT);
      return;
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:InvalidationTestService.java


示例13: acknowledge

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void acknowledge(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(request, Action.ACKNOWLEDGE, Parameter.ACTION, Parameter.CLIENT,
        Parameter.ACK_TOKEN);
    if (!validateClient(request)) {
      response.setStatus(Response.Status.INVALID_CLIENT);
      return;
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:13,代码来源:InvalidationTestService.java


示例14: destroy

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
protected void destroy(Request request, Response.Builder response) {
  synchronized (LOCK) {
    validateRequest(request, Action.DESTROY, Parameter.ACTION, Parameter.CLIENT);
    if (!validateClient(request)) {
      response.setStatus(Response.Status.INVALID_CLIENT);
      return;
    }
    response.setStatus(Response.Status.SUCCESS);
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:InvalidationTestService.java


示例15: validateRequest

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
/**
 * Validates that the request contains exactly the set of parameters expected.
 *
 * @param request request to validate
 * @param action expected action
 * @param parameters expected parameters
 */
private void validateRequest(Request request, Action action, String... parameters) {
  Assert.assertEquals(action, request.getAction());
  List<String> expectedParameters = new ArrayList<String>(Arrays.asList(parameters));
  Bundle requestBundle = request.getBundle();
  for (String parameter : requestBundle.keySet()) {
    Assert.assertTrue("Unexpected parameter: " + parameter, expectedParameters.remove(parameter));

    // Validate the value
    Object value = requestBundle.get(parameter);
    Assert.assertNotNull(value);
  }
  Assert.assertTrue("Missing parameter:" + expectedParameters, expectedParameters.isEmpty());
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:InvalidationTestService.java


示例16: handleRequest

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
protected void handleRequest(Bundle input, Bundle output) {
  synchronized (lock) {
    if (!isCreated) {
      logger.warning("Dropping bundle since not created: %s", input);
      return;
    }
    Request request = new Request(input);
    Response.Builder response = Response.newBuilder(request.getActionOrdinal(), output);
    Action action = request.getAction();
    logger.fine("%s request from %s", action, request.getClientKey());
    try {
      switch(action) {
        case CREATE:
          create(request, response);
          break;
        case RESUME:
          resume(request, response);
          break;
        case START:
          start(request, response);
          break;
        case STOP:
          stop(request, response);
          break;
        case REGISTER:
          register(request, response);
          break;
        case UNREGISTER:
          unregister(request, response);
          break;
        case ACKNOWLEDGE:
          acknowledge(request, response);
          break;
        case DESTROY:
          destroy(request, response);
          break;
        default:
          throw new IllegalStateException("Unknown action:" + action);
      }
    } catch (Exception e) {
      logger.severe("Client request error", e);
      response.setStatus(Status.RUNTIME_ERROR); // Subclass might already have set status.
      response.setException(e);
    }
  }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:47,代码来源:AbstractInvalidationService.java


示例17: start

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
public void start() {
  Request request = Request.newBuilder(Action.START).setClientKey(clientKey).build();
  executeServiceRequest(request);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:6,代码来源:AndroidInvalidationClientImpl.java


示例18: stop

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
public void stop() {
  Request request = Request.newBuilder(Action.STOP).setClientKey(clientKey).build();
  executeServiceRequest(request);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:6,代码来源:AndroidInvalidationClientImpl.java


示例19: toString

import com.google.ipc.invalidation.external.client.android.service.Request.Action; //导入依赖的package包/类
@Override
public String toString() {
  String actionStr = (getActionOrdinal() < Action.values().length) ?
      Action.values()[getActionOrdinal()].toString() : "invalid";
  return "Message ACTION = " + actionStr + " CLIENT = " + getClientKey();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:7,代码来源:Message.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java JmeFormatter类代码示例发布时间:2022-05-22
下一篇:
Java MailValidation类代码示例发布时间: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