Package com.google.apphosting.api.ApiProxy

Examples of com.google.apphosting.api.ApiProxy.Environment


   * @param key the identifier for this recording event used to store stats.
   * @param wasSuccessful whether this method executed successfully.
   */
  public void endCustomRecording(String key, boolean wasSuccessful) {
    long preNow = clock.currentTimeMillis();
    Environment environment = ApiProxy.getCurrentEnvironment();
    if (environment.getAttributes().containsKey(CUSTOM_RECORDING_KEY)) {
      @SuppressWarnings("unchecked")
      Map<String, RecordingData> customRecordings =
          (Map<String, RecordingData>) environment.getAttributes().get(CUSTOM_RECORDING_KEY);
      RecordingData recordingData = customRecordings.get(key);
      if (recordingData != null) {
        writeCustomRecording(environment, recordingData, preNow, wasSuccessful);
        customRecordings.remove(key);
      }
View Full Code Here


   * A cleanup method to write all pending custom recordings to Appstats before
   * finishing current request.
   */
  void finishCustomRecordings() {
    long preNow = clock.currentTimeMillis();
    Environment environment = ApiProxy.getCurrentEnvironment();
    if (environment.getAttributes().containsKey(CUSTOM_RECORDING_KEY)) {
      @SuppressWarnings("unchecked")
      Map<String, RecordingData> customRecordings =
          (Map<String, RecordingData>) environment.getAttributes().get(CUSTOM_RECORDING_KEY);
      for (RecordingData recordingData : customRecordings.values()) {
        writeCustomRecording(environment, recordingData, preNow, false);
      }
      environment.getAttributes().remove(CUSTOM_RECORDING_KEY);
    }
  }
View Full Code Here

    connectContainer();
  }

  @Override
  public final void startup() throws Exception {
    Environment prevEnvironment = ApiProxy.getCurrentEnvironment();
    try {
      initContext();
      if (appEngineWebXml == null) {
        throw new IllegalStateException("initContext failed to initialize appEngineWebXml.");
      }
View Full Code Here

                                                           int instance, int port,
                                                           int defaultModuleMainPort,
                                                           String backendName,
                                                           int backendInstance,
                                                           Map<String, String> portMapping) {
    Environment environment = new LocalInitializationEnvironment(
        appEngineWebXml.getAppId(), WebModule.getModuleName(appEngineWebXml),
        appEngineWebXml.getMajorVersionId(), instance, port);
    environment.getAttributes().put(DEFAULT_VERSION_HOSTNAME, "localhost:"
        + defaultModuleMainPort);
    ApiProxy.setEnvironmentForCurrentThread(environment);
    DevAppServerModulesFilter.injectBackendServiceCurrentApiInfo(backendName, backendInstance,
        portMapping);
  }
View Full Code Here

    String version = getVersion();
    return KeyFactory.createKey(COM_ONPOSITIVE_TRAPS_CALL_STORAGE, version);
  }

  private static String getVersion() {
    Environment env = ApiProxy.getCurrentEnvironment();
    String vId = env.getVersionId();
    String[] splitted = vId.split("\\.");
    String v = splitted[0];
    String version = "v" + v;
    return version;
  }
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    @Test
    public void datastorePutAsync() throws Exception {
        tester.setUp();
        Environment env = ApiProxy.getCurrentEnvironment();
        Delegate<Environment> delegate = ApiProxy.getDelegate();
        PutRequest reqPb = new PutRequest();
        reqPb.addEntity(EntityTranslator.convertToPb(new Entity("Hoge")));
        Future<byte[]> future =
            delegate.makeAsyncCall(
View Full Code Here

    this();
  }

  public GaeXmppService() {
    // built up the host url
    Environment env = ApiProxy.getCurrentEnvironment();
    if (env != null) {
      String appId = env.getAppId();
      if (appId != null) {
        if (appId.startsWith("s~")) {
          // ids of apps with high replication have a "s~" prefix
          appId = appId.substring(2);
        }
View Full Code Here

    this();
  }

  public GaeXmppService() {
    // built up the host url
    Environment env = ApiProxy.getCurrentEnvironment();
    if (env != null) {
      String appId = env.getAppId();
      if (appId != null) {
        if (appId.startsWith("s~")) {
          // ids of apps with high replication have a "s~" prefix
          appId = appId.substring(2);
        }
View Full Code Here

public class SimpleJava extends HttpServlet {

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    Environment env = ApiProxy.getCurrentEnvironment();
    String raw_ver = env.getVersionId();
    String version = raw_ver.substring(0,raw_ver.lastIndexOf("."));
    String path = (req.getPathInfo() == null) ? "null" : req.getPathInfo();
    // print out some stuff
    String message = "app_id:  " + env.getAppId() +
              "\n" + "version: " + version +
              "\n" + "domain:  " + env.getAuthDomain() +
              "\n" +
              "\n" + "RequestURI:  " + req.getRequestURI() +
              "\n" + "PathInfo:    " + path +
              "\n" + "ServletPath: " + req.getServletPath();
    resp.setContentType("text/plain");
View Full Code Here

    this();
  }

  public GaeXmppService() {
    // built up the host url
    Environment env = ApiProxy.getCurrentEnvironment();
    if (env != null) {
      String appId = env.getAppId();
      if (appId != null) {
        if (appId.startsWith("s~")) {
          // ids of apps with high replication have a "s~" prefix
          appId = appId.substring(2);
        }
View Full Code Here

TOP

Related Classes of com.google.apphosting.api.ApiProxy.Environment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.