Package org.apache.hadoop.eclipse.server

Examples of org.apache.hadoop.eclipse.server.HadoopServer$PingJob


    return null;
  }

  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof HadoopServer) {
      HadoopServer location = (HadoopServer) element;
      if (columnIndex == 0) {
        return location.getLocationName();

      } else if (columnIndex == 1) {
        return location.getMasterHostName();
      }
    }

    return element.toString();
  }
View Full Code Here


   */
  private synchronized void load() {
    Map<String, HadoopServer> map = new TreeMap<String, HadoopServer>();
    for (File file : saveDir.listFiles()) {
      try {
        HadoopServer server = new HadoopServer(file);
        map.put(server.getLocationName(), server);

      } catch (Exception exn) {
        System.err.println(exn);
      }
    }
View Full Code Here

  public boolean performFinish() {

    /*
     * Create a new location or get an existing one
     */
    HadoopServer location = null;
    if (mainPage.createNew.getSelection()) {
      location = createNewPage.performFinish();

    } else if (mainPage.table.getSelection().length == 1) {
      location = (HadoopServer) mainPage.table.getSelection()[0].getData();
    }

    if (location == null)
      return false;

    /*
     * Get the base directory of the plug-in for storing configurations and
     * JARs
     */
    File baseDir = Activator.getDefault().getStateLocation().toFile();

    // Package the Job into a JAR
    File jarFile = JarModule.createJarPackage(resource);
    if (jarFile == null) {
      ErrorMessageDialog.display("Run on Hadoop",
          "Unable to create or locate the JAR file for the Job");
      return false;
    }

    /*
     * Generate a temporary Hadoop configuration directory and add it to the
     * classpath of the launch configuration
     */

    File confDir;
    try {
      confDir = File.createTempFile("hadoop-conf-", "", baseDir);
      confDir.delete();
      confDir.mkdirs();
      if (!confDir.isDirectory()) {
        ErrorMessageDialog.display("Run on Hadoop",
            "Cannot create temporary directory: " + confDir);
        return false;
      }
    } catch (IOException ioe) {
      ioe.printStackTrace();
      return false;
    }

    // Prepare the Hadoop configuration
    JobConf conf = new JobConf(location.getConfiguration());
    conf.setJar(jarFile.getAbsolutePath());

    // Write it to the disk file
    try {
      // File confFile = File.createTempFile("core-site-", ".xml",
View Full Code Here

  public Object[] test(Object parentElement) {
    if (parentElement instanceof DFSLocationsRoot) {
      return ServerRegistry.getInstance().getServers().toArray();

    } else if (parentElement instanceof HadoopServer) {
      final HadoopServer location = (HadoopServer) parentElement;
      Object root = rootFolders.get(location);
      if (root != null)
        return new Object[] { root };

      return new Object[] { "Connecting to DFS..." };
View Full Code Here

   */
  /* @inheritDoc */
  public Object[] getChildren(Object parent) {

    if (parent instanceof HadoopServer) {
      HadoopServer location = (HadoopServer) parent;
      location.addJobListener(this);
      Collection<HadoopJob> jobs = location.getJobs();
      return jobs.toArray();
    }

    return null;
  }
View Full Code Here

  }

  /* @inheritDoc */
  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof HadoopServer) {
      HadoopServer server = (HadoopServer) element;

      switch (columnIndex) {
        case 0:
          return server.getLocationName();
        case 1:
          return server.getMasterHostName().toString();
        case 2:
          return server.getState();
        case 3:
          return "";
      }
    } else if (element instanceof HadoopJob) {
      HadoopJob job = (HadoopJob) element;
View Full Code Here

      if ((selection != null) && (selection instanceof IStructuredSelection)) {
        Object selItem =
            ((IStructuredSelection) selection).getFirstElement();

        if (selItem instanceof HadoopServer) {
          HadoopServer location = (HadoopServer) selItem;
          if (MessageDialog.openConfirm(Display.getDefault()
              .getActiveShell(), "Confirm delete Hadoop location",
              "Do you really want to remove the Hadoop location: "
                  + location.getLocationName())) {
            ServerRegistry.getInstance().removeServer(location);
          }

        } else if (selItem instanceof HadoopJob) {
View Full Code Here

  }

  @Override
  public void run() {

    final HadoopServer server = serverView.getSelectedServer();
    if (server == null)
      return;

    WizardDialog dialog = new WizardDialog(null, new Wizard() {
      private HadoopLocationWizard page = new HadoopLocationWizard(server);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.eclipse.server.HadoopServer$PingJob

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.