@Override public DrillTable create(String key) { try { FileSelection fileSelection = FileSelection.create(fs, config.getLocation(), key); if (fileSelection == null) return null; if (fileSelection.containsDirectories(fs)) { for (FormatMatcher m : dirMatchers) { try { Object selection = m.isReadable(fileSelection); if (selection != null) return new DynamicDrillTable(plugin, storageEngineName, selection); } catch (IOException e) { logger.debug("File read failed.", e); } } fileSelection = fileSelection.minusDirectories(fs); } for (FormatMatcher m : fileMatchers) { Object selection = m.isReadable(fileSelection); if (selection != null) return new DynamicDrillTable(plugin, storageEngineName, selection); } return null; } catch (IOException e) { logger.debug( "Failed to create DrillTable with root {} and name {}", config.getLocation(), key, e); } return null; }
/** * Initializes the resource set using the repository content ; if the repository content is empty, * creates all the declared indexes. * * @throws CoreException it the resourceSet cannot be initialized */ private void initializeResourceSet() throws CoreException { // We first get the project on which the repository is defined IProject project = workspaceConfig.getProject(); if (!project.exists()) { project.create(null); } if (!project.isOpen()) { project.open(null); } IFolder folder = project.getFolder(workspaceConfig.getRepositoryRelativePath()); // We created a WorkspaceRepositoryLoader using the indexPathList WorkspaceRepositoryLoader loader = new WorkspaceRepositoryLoader(this, this.getWorkspaceConfig().getIndexesPathList()); // If the repository folder exists if (folder.exists()) { // We load the resourceSet loader.loadResourceSet(); } else { // If the repository folder doesn't exist // We create it folder.create(IResource.NONE, true, null); // And use the RepositoryLoader to initialize the resource set with empty content loader.loadResourceSet(); } isResourceSetLoaded = true; }
private Path getViewPath(String name) { return new Path(config.getLocation() + '/' + name + ".view.drill"); }
/** * {@inheritDoc} * * @see org.eclipse.mylyn.docs.intent.collab.repository.Repository#getIdentifier() */ public String getIdentifier() { return workspaceConfig.getProject().getName(); }