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

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


      throw inE[0];
    if (interrupted) {
      // Tell HDFS manager that the server timed out
      if(logger.isDebugEnabled())
        logger.debug("executeWithTimeout(): Server timed out: "+serverURI);
      HDFSServer server = HDFSManager.INSTANCE.getServer(serverURI);
      String projectName = HDFSManager.INSTANCE.getProjectName(server);
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      HDFSManager.disconnectProject(project);
      throw new InterruptedException();
    }
View Full Code Here


  public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
    if (serverFileInfo == null) {
      serverResourceInfo = null;
      this.effectivePermissions = null;
      FileInfo fi = new FileInfo(getName());
      HDFSServer server = getServer();
      if (server != null) {
        try {
          if (".project".equals(getName())) {
            fi.setExists(getLocalFile().exists());
            fi.setLength(getLocalFile().length());
          } else {
            ResourceInformation fileInformation = getClient().getResourceInformation(uri.getURI(), server.getUserId());
            if (fileInformation != null) {
              serverResourceInfo = fileInformation;
              fi.setDirectory(fileInformation.isFolder());
              fi.setExists(true);
              fi.setLastModified(fileInformation.getLastModifiedTime());
              fi.setLength(fileInformation.getSize());
              fi.setName(fileInformation.getName());
              String userId = server.getUserId();
              List<String> groupIds = server.getGroupIds();
              if (userId == null) {
                userId = getDefaultUserId();
                groupIds = getDefaultGroupIds();
              }
              fileInformation.updateEffectivePermissions(userId, groupIds);
View Full Code Here

      } else {
        ResourceInformation ri = new ResourceInformation();
        ri.setFolder(info.isDirectory());
        if ((options & EFS.SET_LAST_MODIFIED) != 0)
          ri.setLastModifiedTime(info.getLastModified());
        HDFSServer server = getServer();
        getClient().setResourceInformation(uri.getURI(), ri, 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

      logger.debug("[" + uri + "]: openRemoteInputStream()");
    if (".project".equals(getName())) {
      return null;
    } else {
      try {
        HDFSServer server = getServer();
        return getClient().openInputStream(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

   */
  public File getLocalFile() throws CoreException {
    if (localFile == null) {
      final HDFSManager hdfsManager = HDFSManager.INSTANCE;
      final String uriString = uri.getURI().toString();
      HDFSServer server = hdfsManager.getServer(uriString);
      if (server != null) {
        File workspaceFolder = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
        try {
          URI relativeURI = URIUtil.makeRelative(uri.getURI(), new URI(server.getUri()));
          String relativePath = hdfsManager.getProjectName(server) + "/" + relativeURI.toString();
          localFile = new File(workspaceFolder, relativePath);
        } catch (URISyntaxException e) {
          throw new CoreException(new Status(IStatus.ERROR, Activator.BUNDLE_ID, e.getMessage(), e));
        }
View Full Code Here

  public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
    if (logger.isDebugEnabled())
      logger.debug("[" + uri + "]: mkdir()");
    try {
      clearServerFileInfo();
      HDFSServer server = getServer();
      if (getClient().mkdirs(uri.getURI(), server == null ? null : server.getUserId())) {
        return this;
      } else {
        return null;
      }
    } catch (IOException e) {
View Full Code Here

      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof IProject) {
          IProject r = (IProject) object;
          try {
            HDFSServer server = HDFSManager.INSTANCE.getServer(r.getLocationURI().toString());
            enabled = server == null ? false : server.getStatusCode() == ServerStatus.DISCONNECTED_VALUE;
          } catch (Throwable t) {
            enabled = false;
          }
        } else
          enabled = false;
View Full Code Here

      while (itr.hasNext()) {
        Object object = itr.next();
        if (object instanceof IProject) {
          IProject r = (IProject) object;
          try {
            HDFSServer server = HDFSManager.INSTANCE.getServer(r.getLocationURI().toString());
            enabled = server == null ? false : server.getStatusCode() != ServerStatus.DISCONNECTED_VALUE;
          } catch (Throwable t) {
            enabled = false;
          }
        } else
          enabled = false;
View Full Code Here

      URI locationURI = r.getLocationURI();
      if (locationURI != null && HDFSURI.SCHEME.equals(locationURI.getScheme())) {
        try {
          if (r instanceof IProject) {
            final HDFSManager hdfsManager = HDFSManager.INSTANCE;
            HDFSServer server = hdfsManager.getServer(locationURI.toString());
            if (server != null) {
              String serverUrl = server.getUri();
              String userId = server.getUserId();
              if (userId == null) {
                try {
                  userId = hdfsManager.getClient(serverUrl).getDefaultUserAndGroupIds().get(0);
                } catch (Throwable e) {
                  userId = null;
                }
              }
              if (userId == null)
                userId = "";
              else
                userId = userId + "@";
              if (serverUrl != null) {
                try {
                  URI uri = new URI(serverUrl);
                  serverUrl = serverUrl.substring(uri.getScheme().length() + 3);
                } catch (Throwable e) {
                }
              }
              if (serverUrl.endsWith("/"))
                serverUrl = serverUrl.substring(0, serverUrl.length() - 1);
              decoration.addSuffix(" " + userId + serverUrl);
              if (server.getStatusCode() == ServerStatus.DISCONNECTED_VALUE)
                decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_OFFLINE_OVR);
              else
                decoration.addOverlay(org.apache.hdt.ui.Activator.IMAGE_ONLINE_OVR);
            } else
              decoration.addSuffix(" [Unknown server]");
View Full Code Here

                  }
                  if (viewer != null) {
                    Object[] addedArray = addedUris.toArray();
                    for (int ac = 0; ac < addedArray.length; ac++) {
                      String uri = (String) addedArray[ac];
                      HDFSServer server = HDFSManager.INSTANCE.getServer(uri);
                      if (server != null) {
                        try {
                          URI relativeURI = org.eclipse.core.runtime.URIUtil.makeRelative(new URI(uri), new URI(server.getUri()));
                          if (relativeURI != null) {
                            String projectName = HDFSManager.INSTANCE.getProjectName(server);
                            if (projectName != null) {
                              IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
                                  new Path(projectName + "/" + relativeURI.toString()));
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.