Package com.google.appengine.tools.admin

Examples of com.google.appengine.tools.admin.Application


    this.severity = severity;
  }

  protected IStatus run(IProgressMonitor monitor) {

    Application readApplication = null;
    try {
      IPackageFragmentRoot[] packageFragmentRoots = javaGProject
          .getPackageFragmentRoots();
      for (IPackageFragmentRoot r : packageFragmentRoots) {
        int kind = r.getKind();
        if (kind == IPackageFragmentRoot.K_BINARY) {
          String elementName = r.getElementName();
          if (elementName.startsWith("appengine-local-runtime")) {
            File fl = r.getPath().toFile().getParentFile()
                .getParentFile().getParentFile();
            System.setProperty("appengine.sdk.root",
                fl.getAbsolutePath() + File.separatorChar);
          }
          System.out.println(elementName);
        }
      }
      IProject javaProj = javaGProject.getProject();
      IContainer warLocation = WebRootDirProvider.calculate(javaProj);
      if (!warLocation.exists()) {
        throw new FileNotFoundException("War Directory not found");
      }
      readApplication = Application.readApplication(warLocation
          .getLocation().toOSString());
    } catch (IOException e) {
      if (e instanceof FileNotFoundException) {
        Display.getDefault().syncExec(new Runnable() {

         
          public void run() {
            MessageDialog.openError(Display.getDefault()
                .getActiveShell(), "Error",
                "War directory did not found.");
            PreferencesUtil.createPreferenceDialogOn(Display
                .getDefault().getActiveShell(),
                "com.onpositive.gae.tools.core.weblocation",
                new String[] {}, null);
          }

        });
      }
      return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
          IStatus.ERROR, e.getMessage(), e);
    } catch (JavaModelException e) {
      e.printStackTrace();
    }

    ConnectOptions connectOptions = ConnectionOptionsManager
        .getOptions(readApplication.getAppId());
    if (connectOptions == null) {
      return Status.CANCEL_STATUS;
    }
    AppAdmin createAppAdmin2 = new AppAdminFactory().createAppAdmin(
        connectOptions, readApplication, new PrintWriter(System.err));
View Full Code Here


        String appId = configuration.getAppId();
        final String module = configuration.getModule();

        if (archive instanceof WebArchive) {
            Application app = readApplication("");

            if (appId != null) {
                app.getAppEngineWebXml().setAppId(appId);
            } else if (appId == null) {
                appId = app.getAppEngineWebXml().getAppId();
            }

            if (module != null) {
                app.getAppEngineWebXml().setModule(module);
            }

            handleApp(app);
        } else if (archive instanceof EnterpriseArchive) {
            EnterpriseArchive ear = EnterpriseArchive.class.cast(archive);
            if (appId == null) {
                Node aaXml = ear.get(ParseUtils.APPENGINE_APPLICATION_XML);
                if (aaXml == null) {
                    throw new IllegalArgumentException("Missing appengine-application.xml: " + ear);
                }
                try {
                    Map<String, String> results = ParseUtils.parseTokens(aaXml, ParseUtils.APPLICATION);
                    appId = results.get(ParseUtils.APPLICATION);
                } catch (Exception e) {
                    throw new DeploymentException(e.getMessage());
                }
            }

            if (module != null) {
                String war = modules.get(module);
                if (war == null) {
                    throw new IllegalArgumentException(String.format("No such module %s in %s", module, modules));
                }

                Application app = readApplication(war);

                if (appId != null) {
                    app.getAppEngineWebXml().setAppId(appId);
                }

                app.getAppEngineWebXml().setModule(module);

                handleApp(app);
            } else {
                for (Map.Entry<String, String> entry : modules.entrySet()) {
                    Application app = readApplication(entry.getValue());

                    if (appId != null) {
                        app.getAppEngineWebXml().setAppId(appId);
                    }

                    handleApp(app);
                }
            }
View Full Code Here

        String appId = configuration.getAppId();
        final String module = configuration.getModule();

        if (archive instanceof WebArchive) {
            Application app = readApplication("");

            if (appId != null) {
                app.getAppEngineWebXml().setAppId(appId);
            } else if (appId == null) {
                appId = app.getAppEngineWebXml().getAppId();
            }

            if (module != null) {
                app.getAppEngineWebXml().setModule(module);
            }

            handleApp(app);
        } else if (archive instanceof EnterpriseArchive) {
            EnterpriseArchive ear = EnterpriseArchive.class.cast(archive);
            if (appId == null) {
                Node aaXml = ear.get(ParseUtils.APPENGINE_APPLICATION_XML);
                if (aaXml == null) {
                    throw new IllegalArgumentException("Missing appengine-application.xml: " + ear);
                }
                try {
                    Map<String, String> results = ParseUtils.parseTokens(aaXml, ParseUtils.APPLICATION);
                    appId = results.get(ParseUtils.APPLICATION);
                } catch (Exception e) {
                    throw new DeploymentException(e.getMessage());
                }
            }

            if (module != null) {
                String war = modules.get(module);
                if (war == null) {
                    throw new IllegalArgumentException(String.format("No such module %s in %s", module, modules));
                }

                Application app = readApplication(war);

                if (appId != null) {
                    app.getAppEngineWebXml().setAppId(appId);
                }

                app.getAppEngineWebXml().setModule(module);

                handleApp(app);
            } else {
                for (Map.Entry<String, String> entry : modules.entrySet()) {
                    Application app = readApplication(entry.getValue());

                    if (appId != null) {
                        app.getAppEngineWebXml().setAppId(appId);
                    }

                    handleApp(app);
                }
            }
View Full Code Here

                if (updateCheck.allowedToCheckForUpdates()) {
                    updateCheck.maybePrintNagScreen(new PrintStream(System.out, true));
                }
            }

            final Application app = readApplication();

            String appId = configuration.getAppId();
            if (appId != null) {
                app.getAppEngineWebXml().setAppId(appId);
            }

            String module = configuration.getModule();
            if (module != null) {
                app.getAppEngineWebXml().setModule(module);
            }

            final AppAdmin appAdmin = createAppAdmin(app);

            final DeployUpdateListener listener = new DeployUpdateListener(
                this,
                new PrintWriter(System.out, true),
                new PrintWriter(System.err, true)
            );

            getExecutor().execute(new Runnable() {
                public void run() {
                    appAdmin.update(listener);
                }
            });

            Status status;
            synchronized (this) {
                do {
                    wait(configuration.getStartupTimeout());
                    status = listener.getStatus();
                } while (status == null); // guard against spurious wakeup
            }

            if (status != Status.OK) {
                throw new DeploymentException("Cannot deploy via GAE tools: " + status);
            }

            String id;
            if (module != null) {
                id = app.getApiVersion() + DOT + module + DOT + app.getAppId();
            } else {
                id = app.getVersion() + DOT + app.getAppId();
            }

            String server = configuration.getServer();
            if (server == null) {
                server = "appspot.com";
View Full Code Here

TOP

Related Classes of com.google.appengine.tools.admin.Application

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.