PluginType extractPluginMetadata(Artifact artifact) { for (Repository repo: repos) { if (repo.contains(artifact)) { File location = repo.getLocation(artifact); return extractPluginMetadata(location); } } return null; }
private ArrayList getChildDependencies(Dependency dependency) { ArrayList childDependencies = new ArrayList(); for (Iterator repositoryIterator = repositories.iterator(); repositoryIterator.hasNext();) { Repository repository = (Repository) repositoryIterator.next(); if (repository.contains(dependency.getArtifact())) { // get the child artifacts LinkedHashSet childArtifacts = repository.getDependencies(dependency.getArtifact()); for (Iterator artifactIterator = childArtifacts.iterator(); artifactIterator.hasNext();) { Artifact artifact = (Artifact) artifactIterator.next(); // add each child as a classes-only dependency childDependencies.add(new Dependency(artifact, ImportType.CLASSES)); } } } return childDependencies; } }
public File getLocation(Artifact artifact) { return repo.getLocation(artifact); }
public boolean contains(Artifact artifact) { return repo.contains(artifact); }
public PluginListType getPluginList() { Map<PluginType, PluginType> pluginMap = new HashMap<PluginType, PluginType>(); for (Repository listableRepository : repos) { if (listableRepository instanceof ListableRepository) { SortedSet<Artifact> artifacts = ((ListableRepository) listableRepository).list(); for (Artifact artifact : artifacts) { File location = listableRepository.getLocation(artifact); PluginType data = extractPluginMetadata(location); if (data != null) { PluginType key = PluginInstallerGBean.toKey(data); PluginType existing = pluginMap.get(key); if (existing == null) { pluginMap.put(key, data); } else { existing.getPluginArtifact().addAll(data.getPluginArtifact()); } } } } } PluginListType pluginList = new PluginListType(); pluginList.getPlugin().addAll(pluginMap.values()); return pluginList; }
public File resolve(Artifact artifact) throws MissingDependencyException { for (Iterator j = repositories.iterator(); j.hasNext();) { Repository repository = (Repository) j.next(); if (repository.contains(artifact)) { File file = repository.getLocation(artifact); return file; } } throw new MissingDependencyException("Unable to resolve dependency " + artifact); }
public OpenResult open(Artifact artifact, FileWriteMonitor monitor) throws IOException, FailedLoginException { try { artifact = artifactResolver.resolveInClassLoader(artifact); } catch (MissingDependencyException e) { return null; } for (Repository repo: repos) { if (repo.contains(artifact)) { File location = repo.getLocation(artifact); if (location.isFile()) { return new LocalOpenResult(artifact, location); } if (location.isDirectory()) { return new ZipOpenResult(artifact, repo); } } } return null; }
public static File getRepositoryEntry(PortletRequest request, String repositoryURI) { J2EEServer server = getCurrentServer(request); Repository[] repos = server.getRepositories(); Artifact uri = Artifact.create(repositoryURI); if (!uri.isResolved()) { Artifact[] all = server.getConfigurationManager().getArtifactResolver().queryArtifacts(uri); if (all.length == 0) { return null; } else { uri = all[all.length - 1]; } } for (int i = 0; i < repos.length; i++) { Repository repo = repos[i]; if (repo.contains(uri)) { return repo.getLocation(uri); } } return null; }
if (repository.contains(artifact)) { location = repository.getLocation(artifact); break;