Package org.apache.hdt.core.internal.model

Examples of org.apache.hdt.core.internal.model.HDFSServer


  public OutputStream openRemoteOutputStream(int options, IProgressMonitor monitor) throws CoreException {
    if (logger.isDebugEnabled())
      logger.debug("[" + uri + "]: openRemoteOutputStream()");
    try {
      HDFSServer server = getServer();
      clearServerFileInfo();
      if (fetchInfo().exists())
        return getClient().openOutputStream(uri.getURI(), server == null ? null : server.getUserId());
      else
        return getClient().createOutputStream(uri.getURI(), server == null ? null : server.getUserId());
    } catch (IOException e) {
      throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
    } catch (InterruptedException e) {
      throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
    }
View Full Code Here


        final File plf = lf.getParentFile();
        lf.delete();
        UploadFileJob.deleteFoldersIfEmpty(plf);
      }
      if (isRemoteFile()) {
        final HDFSServer server = getServer();
        if (server != null) {
          if (server.getUri().equals(uri.getURI().toString())) {
            // Server location is the same as the project - so we
            // just
            // disconnect instead of actually deleting the root
            // folder
            // on HDFS.
          } else {
            clearServerFileInfo();
            getClient().delete(uri.getURI(), server == null ? null : server.getUserId());
          }
        } else {
          // Not associated with any server, we just disconnect.
        }
      }
View Full Code Here

  public static HDFSManager INSTANCE = new HDFSManager();
  private static final Logger logger = Logger.getLogger(HDFSManager.class);

  public static void disconnectProject(IProject project) {
    HDFSServer server = HDFSManager.INSTANCE.getServer(project.getLocationURI().toString());
    if (server != null && server.getStatusCode() != ServerStatus.DISCONNECTED_VALUE)
      server.setStatusCode(ServerStatus.DISCONNECTED_VALUE);
    try {
      project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
    } catch (CoreException e) {
      logger.warn(e.getMessage(), e);
    }
View Full Code Here

      logger.warn(e.getMessage(), e);
    }
  }

  public static void reconnectProject(IProject project) {
    HDFSServer server = HDFSManager.INSTANCE.getServer(project.getLocationURI().toString());
    if (server != null && server.getStatusCode() == ServerStatus.DISCONNECTED_VALUE)
      server.setStatusCode(0);
    try {
      project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
    } catch (CoreException e) {
      logger.warn(e.getMessage(), e);
    }
View Full Code Here

      } catch (URISyntaxException e) {
      }
    }
    if (ResourcesPlugin.getWorkspace().getRoot().getProject(name).exists())
      throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, "Project with name '" + name + "' already exists"));
    HDFSServer hdfsServer = HadoopFactory.eINSTANCE.createHDFSServer();
    hdfsServer.setName(name);
    hdfsServer.setUri(hdfsURI.toString());
    hdfsServer.setLoaded(true);
    if (userId != null)
      hdfsServer.setUserId(userId);
    if (groupIds != null)
      for (String groupId : groupIds)
        hdfsServer.getGroupIds().add(groupId);
    getHdfsServers().add(hdfsServer);
    HadoopManager.INSTANCE.saveServers();
    uriToServerMap.put(hdfsServer.getUri(), hdfsServer);
    serverToProjectMap.put(hdfsServer, name);
    projectToServerMap.put(name, hdfsServer);
    createIProject(name, hdfsURI);
    return hdfsServer;
  }
View Full Code Here

  }

  public HDFSServer getServer(String uri) {
    if (uri != null && !uriToServerCacheMap.containsKey(uri)) {
      String tmpUri = uri;
      HDFSServer serverU = uriToServerMap.get(tmpUri);
      while (serverU == null) {
        int lastSlashIndex = tmpUri.lastIndexOf('/');
        tmpUri = lastSlashIndex < 0 ? null : tmpUri.substring(0, lastSlashIndex);
        if (tmpUri != null)
          serverU = uriToServerMap.get(tmpUri + "/");
View Full Code Here

  /**
   * @param string
   */
  public void startServerOperation(String uri) {
    HDFSServer server = getServer(uri);
    if (server != null && !server.getOperationURIs().contains(uri)) {
      server.getOperationURIs().add(uri);
    }
  }
View Full Code Here

  /**
   * @param string
   */
  public void stopServerOperation(String uri) {
    HDFSServer server = getServer(uri);
    if (server != null) {
      server.getOperationURIs().remove(uri);
    }
  }
View Full Code Here

      server.getOperationURIs().remove(uri);
    }
  }

  public boolean isServerOperationRunning(String uri) {
    HDFSServer server = getServer(uri);
    if (server != null) {
      return server.getOperationURIs().contains(uri);
    }
    return false;
  }
View Full Code Here

   * @throws CoreException
   */
  public HDFSClient getClient(String serverURI) throws CoreException {
    if (logger.isDebugEnabled())
      logger.debug("getClient(" + serverURI + "): Server=" + serverURI);
    HDFSServer server = getServer(serverURI);
    if (server != null && server.getStatusCode() == ServerStatus.DISCONNECTED_VALUE) {
      if (logger.isDebugEnabled())
        logger.debug("getClient(" + serverURI + "): Server timed out. Not returning client");
      throw new CoreException(new Status(IStatus.WARNING, Activator.BUNDLE_ID, "Server disconnected due to timeout. Please reconnect to server."));
    }
    if (hdfsClientsMap.containsKey(serverURI))
View Full Code Here

TOP

Related Classes of org.apache.hdt.core.internal.model.HDFSServer

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.