Package org.eclipse.core.filesystem

Examples of org.eclipse.core.filesystem.IFileStore


    JSONObject project = new JSONObject(response.getText());
    testProjectLocalFileLocation = "/" + project.optString(ProtocolConstants.KEY_ID, null);
  }

  protected boolean checkDirectoryExists(String path) throws CoreException {
    IFileStore dir = EFS.getStore(makeLocalPathAbsolute(path));
    return (dir.fetchInfo().exists() && dir.fetchInfo().isDirectory());
  }
View Full Code Here


    IFileStore dir = EFS.getStore(makeLocalPathAbsolute(path));
    return (dir.fetchInfo().exists() && dir.fetchInfo().isDirectory());
  }

  protected boolean checkFileExists(String path) throws CoreException {
    IFileStore file = EFS.getStore(makeLocalPathAbsolute(path));
    return (file.fetchInfo().exists() && !file.fetchInfo().isDirectory());
  }
View Full Code Here

   * Creates a new directory in the server's local file system at the root location for the file servlet.
   */
  protected IFileStore createDirectory(String path) throws CoreException {
    IFileInfo info = null;
    URI location = makeLocalPathAbsolute(path);
    IFileStore dir = EFS.getStore(location);
    dir.mkdir(EFS.NONE, null);
    info = dir.fetchInfo();
    assertTrue("Coudn't create directory " + path, info.exists() && info.isDirectory());

    return dir;
  }
View Full Code Here

    return dir;
  }

  protected static IFileStore createFile(URI uri, String fileContent) throws CoreException {
    IFileStore outputFile = EFS.getStore(uri);
    outputFile.delete(EFS.NONE, null);
    InputStream input = new ByteArrayInputStream(fileContent.getBytes());
    transferData(input, outputFile.openOutputStream(EFS.NONE, null));
    IFileInfo info = outputFile.fetchInfo();
    assertTrue("Coudn't create file " + uri, info.exists() && !info.isDirectory());

    return outputFile;
  }
View Full Code Here

      String projectName = basePath.segment(1);
      ProjectInfo projectInfo = OrionConfiguration.getMetaStore().readProject(workspaceId, projectName);
      if (projectInfo == null) {
        return null;
      }
      IFileStore projectStore = OrionConfiguration.getMetaStore().getDefaultContentLocation(projectInfo);
      String encodedProjectRoot = projectStore.toURI().toString() + "/";
      String projectRoot = URLDecoder.decode(encodedProjectRoot, "UTF-8");
      String absolutePath = new Path(projectRoot).append(path).toString();
      return absolutePath;
    } catch (CoreException e) {
      fail(e.getLocalizedMessage());
View Full Code Here

      return null;
    }
  }

  protected static void initializeWorkspaceLocation() {
    IFileStore root = OrionConfiguration.getRootLocation();
    FILESTORE_PREFIX = root.toURI().toString() + "/";
  }
View Full Code Here

  }

  protected void remove(String path) throws CoreException {
    String absolutePath = getAbsolutePath(path);
    if (absolutePath != null) {
      IFileStore outputFile = EFS.getStore(URI.create(absolutePath));
      outputFile.delete(EFS.NONE, null);
    }
  }
View Full Code Here

    workspaceInfo.setFullName(workspaceName);
    workspaceInfo.setUserId(userInfo.getUniqueId());
    metaStore.createWorkspace(workspaceInfo);

    // create an empty organizational folder
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String orgFolderName = "zz";
    IFileStore orgFolder = rootLocation.getChild(orgFolderName);
    assertFalse(orgFolder.fetchInfo().exists());
    orgFolder.mkdir(EFS.NONE, null);
    assertTrue(orgFolder.fetchInfo().exists());
    assertTrue(orgFolder.fetchInfo().isDirectory());

    // read all the users which will trigger the archive
    List<String> users = metaStore.readAllUsers();
    assertNotNull(users);

    // verify the invalid metadata folder has moved to the archive
    IFileStore archiveFolder = rootLocation.getChild(SimpleMetaStoreUtil.ARCHIVE);
    assertTrue(archiveFolder.fetchInfo().exists());
    assertTrue(archiveFolder.fetchInfo().isDirectory());
    IFileStore archivedOrgFolder = archiveFolder.getChild(orgFolderName);
    assertTrue(archivedOrgFolder.fetchInfo().exists());
    assertTrue(archivedOrgFolder.fetchInfo().isDirectory());
    assertFalse(orgFolder.fetchInfo().exists());
  }
View Full Code Here

    workspaceInfo.setFullName(workspaceName);
    workspaceInfo.setUserId(userInfo.getUniqueId());
    metaStore.createWorkspace(workspaceInfo);

    // create a invalid metadata file
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String orgFolderName = "te";
    IFileStore orgFolder = rootLocation.getChild(orgFolderName);
    assertTrue(orgFolder.fetchInfo().exists());
    assertTrue(orgFolder.fetchInfo().isDirectory());
    String invalid = "delete.html";
    IFileStore invalidFileInOrg = orgFolder.getChild(invalid);
    try {
      OutputStream outputStream = invalidFileInOrg.openOutputStream(EFS.NONE, null);
      outputStream.write("<!doctype html>".getBytes());
      outputStream.close();
    } catch (IOException e) {
      fail("Count not create a test file in the Orion Project:" + e.getLocalizedMessage());
    }
    assertTrue(invalidFileInOrg.fetchInfo().exists());

    // read all the users which will trigger the archive
    List<String> users = metaStore.readAllUsers();
    assertNotNull(users);

    // verify the invalid metadata file has moved to the archive
    IFileStore archiveFolder = rootLocation.getChild(SimpleMetaStoreUtil.ARCHIVE);
    assertTrue(archiveFolder.fetchInfo().exists());
    assertTrue(archiveFolder.fetchInfo().isDirectory());
    IFileStore archiveOrgFolder = archiveFolder.getChild(orgFolderName);
    assertTrue(archiveOrgFolder.fetchInfo().exists());
    assertTrue(archiveOrgFolder.fetchInfo().isDirectory());
    IFileStore archivedFile = archiveOrgFolder.getChild(invalid);
    assertTrue(archivedFile.fetchInfo().exists());
    assertFalse(invalidFileInOrg.fetchInfo().exists());
  }
View Full Code Here

    workspaceInfo.setFullName(workspaceName);
    workspaceInfo.setUserId(userInfo.getUniqueId());
    metaStore.createWorkspace(workspaceInfo);

    // create a invalid metadata file
    IFileStore rootLocation = OrionConfiguration.getRootLocation();
    String invalid = "delete.html";
    IFileStore invalidFileAtRoot = rootLocation.getChild(invalid);
    try {
      OutputStream outputStream = invalidFileAtRoot.openOutputStream(EFS.NONE, null);
      outputStream.write("<!doctype html>".getBytes());
      outputStream.close();
    } catch (IOException e) {
      fail("Count not create a test file in the Orion Project:" + e.getLocalizedMessage());
    }
    assertTrue(invalidFileAtRoot.fetchInfo().exists());

    // read all the users which will trigger the archive
    List<String> users = metaStore.readAllUsers();
    assertNotNull(users);

    // verify the invalid metadata file has moved to the archive
    IFileStore archiveFolder = rootLocation.getChild(SimpleMetaStoreUtil.ARCHIVE);
    assertTrue(archiveFolder.fetchInfo().exists());
    assertTrue(archiveFolder.fetchInfo().isDirectory());
    IFileStore archivedFile = archiveFolder.getChild(invalid);
    assertTrue(archivedFile.fetchInfo().exists());
    assertFalse(invalidFileAtRoot.fetchInfo().exists());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.filesystem.IFileStore

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.