Package org.apache.hdt.core.launch

Examples of org.apache.hdt.core.launch.AbstractHadoopCluster


    return null;
  }

  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof AbstractHadoopCluster) {
      AbstractHadoopCluster location = (AbstractHadoopCluster) 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, AbstractHadoopCluster> map = new TreeMap<String, AbstractHadoopCluster>();
    for (File file : saveDir.listFiles()) {
      try {
        AbstractHadoopCluster server = AbstractHadoopCluster.createCluster(file);
        map.put(server.getLocationName(), server);

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

  }

  @Override
  public void run() {

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

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

  public boolean performFinish() {

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

    } else if (mainPage.table.getSelection().length == 1) {
      location = (AbstractHadoopCluster) 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;
    }
    try {
      location.saveConfiguration(confDir, jarFile.getAbsolutePath());
    } catch (IOException ioe) {
      ioe.printStackTrace();
      return false;
    }
    // Setup the Launch class path
View Full Code Here

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

    if (parent instanceof AbstractHadoopCluster) {
      AbstractHadoopCluster location = (AbstractHadoopCluster) parent;
      location.addJobListener(this);
      Collection<? extends IHadoopJob> jobs = location.getJobs();
      return jobs.toArray();
    }

    return null;
  }
View Full Code Here

  }

  /* @inheritDoc */
  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof AbstractHadoopCluster) {
      AbstractHadoopCluster server = (AbstractHadoopCluster) 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 IHadoopJob) {
      IHadoopJob job = (IHadoopJob) element;
View Full Code Here

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

        if (selItem instanceof AbstractHadoopCluster) {
          AbstractHadoopCluster location = (AbstractHadoopCluster) 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 IHadoopJob) {
View Full Code Here

    Display.getDefault().syncExec(new Runnable() {
      public void run() {
        BasicNewProjectResourceWizard.updatePerspective(configElement);
      }
    });
    AbstractHadoopCluster cluster = serverLocationWizardPage.performFinish();
    return cluster!=null;
  }
View Full Code Here

TOP

Related Classes of org.apache.hdt.core.launch.AbstractHadoopCluster

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.