Examples of IMetaStore


Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    while (path.segmentCount() != 0 && !path.segment(0).equals("file")) {
      path = path.removeFirstSegments(1);
    }

    //path format is /file/{workspaceId}/{projectName}[/path]
    final IMetaStore metaStore = OrionConfiguration.getMetaStore();
    WorkspaceInfo workspace = metaStore.readWorkspace(path.segment(1));
    assertNotNull(workspace);
    ProjectInfo wp = metaStore.readProject(workspace.getUniqueId(), path.segment(2));
    assertNotNull(wp);
    String userId = workspace.getUserId();
    assertNotNull(userId);
    IFileStore fsStore = getProjectStore(wp, userId);
    fsStore = fsStore.getFileStore(path.removeFirstSegments(3));
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    assertEquals(hosts.get(1), "127.0.0.3"); //$NON-NLS-1$
  }

  @Test
  public void testSiteHostingServiceStart() throws Exception {
    IMetaStore metaStore = getMetaStore();

    SiteHostingService hostingService = new SiteHostingService(SiteHostingConfig.getSiteHostingConfig("https://*.sites.example.org:1234"));

    UserInfo user = new UserInfo();
    user.setUniqueId("A");
    user.setUserName("carlos");
    metaStore.createUser(user);

    SiteInfo site = SiteInfo.newSiteConfiguration(user, "mysite", "myworkspace");
    site.setId("s1");
    site.setName("Some site");
    site.setHostHint("foo");
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    assertEquals("https://foo.sites.example.org:1234", vhost.getUrl());
  }

  @Test
  public void testSiteHostingServiceStartHostnameTaken() throws Exception {
    IMetaStore metaStore = getMetaStore();

    SiteHostingService hostingService = new SiteHostingService(SiteHostingConfig.getSiteHostingConfig("https://*.sites.example.org"));

    UserInfo user = new UserInfo();
    user.setUniqueId("A");
    user.setUserName("carlos");
    metaStore.createUser(user);

    SiteInfo site1 = SiteInfo.newSiteConfiguration(user, "site1", "myworkspace");
    site1.setId("s1");
    site1.setName("Site 1");
    site1.setHostHint("foo");
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    assertEquals("https://foo0.sites.example.org", hostingService.get(site2, user).getUrl());
  }

  @Test
  public void testSiteHostingServiceMatchesVirtualHost() throws Exception {
    IMetaStore metaStore = getMetaStore();

    SiteHostingService hostingService = new SiteHostingService(SiteHostingConfig.getSiteHostingConfig("https://*.sites.example.org:1234"));

    UserInfo user = new UserInfo();
    user.setUniqueId("A");
    user.setUserName("carlos");
    metaStore.createUser(user);

    SiteInfo site = SiteInfo.newSiteConfiguration(user, "mysite", "myworkspace");
    site.setId("s1");
    site.setName("Some site");
    site.setHostHint("foo");
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

   *
   * @throws CoreException
   */
  private ProjectInfo getProjectForLocation(String location) throws CoreException {
    // location is URI of the form protocol:/workspace/workspaceId/project/projectName
    IMetaStore store = OrionConfiguration.getMetaStore();
    return WorkspaceResourceHandler.projectForMetadataLocation(store, location);
  }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    try {
      if (logger.isInfoEnabled()) {
        logger.info("Orion disk usage user data job started"); //$NON-NLS-1$
      }

      IMetaStore metaStore = OrionConfiguration.getMetaStore();
      List<String> userids = metaStore.readAllUsers();
      for (String userId : userids) {
        File userRoot = metaStore.getUserHome(userId).toLocalFile(EFS.NONE, null);
        String diskUsage = getFolderSize(userRoot);
        UserInfo userInfo = metaStore.readUser(userId);
        // try to store the disk usage timestamp and value in the user profile
        userInfo.setProperty(UserConstants2.DISK_USAGE, diskUsage);
        userInfo.setProperty(UserConstants2.DISK_USAGE_TIMESTAMP, new Long(System.currentTimeMillis()).toString());
        metaStore.updateUser(userInfo);
      }
      if (logger.isInfoEnabled()) {
        logger.info("Orion disk usage user data updated"); //$NON-NLS-1$
      }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    initDockerServer();
  }

  private void createBashrc(String user) {
    try {
      IMetaStore metaStore = OrionConfiguration.getMetaStore();
      UserInfo userInfo = metaStore.readUser(user);
      List<String> workspaceIds = userInfo.getWorkspaceIds();
      if (workspaceIds.isEmpty()) {
        // the user has no workspaces, just return
        return;
      }
      String workspaceId = workspaceIds.get(0);

      // see if the .bashrc already exists
      IFileStore workspaceContentLocation = metaStore.getWorkspaceContentLocation(workspaceId);
      IFileStore bashrc = workspaceContentLocation.getChild(".bashrc");
      if (bashrc.fetchInfo().exists()) {
        // .bashrc already exists, return
        return;
      }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    return dockerServer;
  }

  private String getDockerVolume(String user) {
    try {
      IMetaStore metaStore = OrionConfiguration.getMetaStore();
      UserInfo userInfo = metaStore.readUser(user);
      List<String> workspaceIds = userInfo.getWorkspaceIds();
      if (workspaceIds.isEmpty()) {
        // the user has no workspaces so no projects
        return null;
      }
      String workspaceId = workspaceIds.get(0);

      IFileStore workspaceContentLocation = metaStore.getWorkspaceContentLocation(workspaceId);
      String localVolume = workspaceContentLocation.toLocalFile(EFS.NONE, null).getAbsolutePath();
      String volume = localVolume + ":/home/" + user + ":rw";
      if (logger.isDebugEnabled()) {
        logger.debug("Created Docker Volume \"" + volume + "\" for user " + user);
      }
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

    // Delete user from metadata store
    try {
      @SuppressWarnings("unused")
      Activator r = Activator.getDefault();
      final IMetaStore metastore = OrionConfiguration.getMetaStore();
      if (userInfo.getWorkspaceIds().size() > 0) {
        for (String workspaceId : userInfo.getWorkspaceIds()) {
          WorkspaceInfo workspaceInfo = metastore.readWorkspace(workspaceId);
          if (workspaceInfo.getProjectNames().size() > 0) {
            for (String projectName : workspaceInfo.getProjectNames()) {
              ProjectInfo projectInfo = metastore.readProject(workspaceId, projectName);
              if (projectInfo != null) {
                WorkspaceResourceHandler.removeProject(userId, workspaceInfo, projectInfo);
              }
            }
          }
        }
      }
      metastore.deleteUser(userId);
    } catch (CoreException e) {
      return statusHandler.handleRequest(req, resp, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Removing " + userId + " failed.", e));
    }
    Logger logger = LoggerFactory.getLogger("org.eclipse.orion.server.account"); //$NON-NLS-1$
    if (logger.isInfoEnabled())
View Full Code Here

Examples of org.eclipse.orion.server.core.metastore.IMetaStore

      return;
    }
  }

  private void save(MetadataInfo info) throws CoreException {
    IMetaStore store = OrionConfiguration.getMetaStore();
    if (info instanceof UserInfo) {
      store.updateUser((UserInfo) info);
    } else if (info instanceof WorkspaceInfo) {
      store.updateWorkspace((WorkspaceInfo) info);
    } else if (info instanceof ProjectInfo) {
      store.updateProject((ProjectInfo) info);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.