Package org.apache.ivy.core.resolve

Examples of org.apache.ivy.core.resolve.IvyNode


        return (IvyNode[])downloaded.toArray(new IvyNode[downloaded.size()]);
    }
    public IvyNode[] getSearchedNodes() {
        List downloaded = new ArrayList();
        for (Iterator iter = getDependencies().iterator(); iter.hasNext();) {
            IvyNode node = (IvyNode)iter.next();
            if (node.isSearched() && node.getRealNode() == node) {
                downloaded.add(node);
            }
        }
        return (IvyNode[])downloaded.toArray(new IvyNode[downloaded.size()]);
    }
View Full Code Here


  public List getModuleIds() {
    if (_modulesIds == null) {
      List sortedDependencies = _resolveEngine.getSortEngine().sortNodes(getDependencies());
            Collections.reverse(sortedDependencies);
      for (Iterator iter = sortedDependencies.iterator(); iter.hasNext();) {
                IvyNode dependency = (IvyNode) iter.next();
        ModuleId mid = dependency.getResolvedId().getModuleId();
        Collection deps = (Collection)_modulesIdsMap.get(mid);
        if (deps == null) {
          deps = new HashSet();
          _modulesIdsMap.put(mid, deps);
        }
View Full Code Here

      ModuleId mid = (ModuleId) iter.next();
      out.println("\t\t<module organisation=\""+mid.getOrganisation()+"\"" +
          " name=\""+mid.getName()+"\"" +
          " resolver=\""+report.getResolveEngine().getSettings().getResolverName(mid)+"\">");
      for (Iterator it2 = report.getNodes(mid).iterator(); it2.hasNext();) {
                IvyNode dep = (IvyNode)it2.next();
                ModuleDescriptor md = null;
                if (dep.getModuleRevision() != null) {
                    md = dep.getModuleRevision().getDescriptor();
                }
                StringBuffer details = new StringBuffer();
                if  (dep.isLoaded()) {
                    details.append(" status=\"").append(dep.getDescriptor().getStatus()).append("\"").append(
                        " pubdate=\"").append(Ivy.DATE_FORMAT.format(new Date(dep.getPublication()))).append("\"").append(
                        " resolver=\"").append(dep.getModuleRevision().getResolver().getName()).append("\"").append(
                        " artresolver=\"").append(dep.getModuleRevision().getArtifactResolver().getName()).append("\"");
                }
                if (dep.isEvicted(report.getConfiguration())) {
                    EvictionData ed = dep.getEvictedData(report.getConfiguration());
                    if (ed.getConflictManager() != null) {
                        details.append(" evicted=\"").append(ed.getConflictManager()).append("\"");
                    } else {
                        details.append(" evicted=\"transitive\"");
                    }
                }
                if (dep.hasProblem()) {
                    details.append(" error=\"").append(dep.getProblem().getMessage()).append("\"");
                }
                if (md != null && md.getHomePage() != null) {
                    details.append(" homepage=\"").append(md.getHomePage()).append("\"");
                }
                extraAttributes = md!=null?md.getExtraAttributes():dep.getResolvedId().getExtraAttributes();
                for (Iterator iterator = extraAttributes.keySet().iterator(); iterator.hasNext();) {
                    String attName = (String)iterator.next();
                    details.append(" extra-").append(attName).append("=\"").append(extraAttributes.get(attName)).append("\"");
                }
        String defaultValue = dep.getDescriptor() != null ? " default=\""+dep.getDescriptor().isDefault()+"\"" : "";
                int position = dependencies.indexOf(dep.getResolvedId());
                out.println("\t\t\t<revision name=\""+dep.getResolvedId().getRevision()+"\"" +
                     (dep.getResolvedId().getBranch() == null?"":" branch=\""+dep.getResolvedId().getBranch()+"\"")+
             details +
                         " downloaded=\""+dep.isDownloaded()+"\""+
                         " searched=\""+dep.isSearched()+"\""+
                         defaultValue+
                         " conf=\""+toString(dep.getConfigurations(report.getConfiguration()))+"\""+
                         " position=\""+position+"\">");
                if (md != null) {
                    License[] licenses = md.getLicenses();
                    for (int i = 0; i < licenses.length; i++) {
                        String lurl;
                        if (licenses[i].getUrl() != null) {
                            lurl = " url=\""+licenses[i].getUrl()+"\"";
                        } else {
                            lurl = "";
                        }
                        out.println("\t\t\t\t<license name=\""+licenses[i].getName()+"\""+lurl+"/>");
                    }
                }
                if (dep.isEvicted(report.getConfiguration())) {
                    EvictionData ed = dep.getEvictedData(report.getConfiguration());
                    Collection selected = ed.getSelected();
                    if (selected != null) {
                        for (Iterator it3 = selected.iterator(); it3.hasNext();) {
                            IvyNode sel = (IvyNode)it3.next();
                            out.println("\t\t\t\t<evicted-by rev=\""+sel.getResolvedId().getRevision()+"\"/>");
                        }
                    }
                }
                Caller[] callers = dep.getCallers(report.getConfiguration());
        for (int i = 0; i < callers.length; i++) {
View Full Code Here

  public void setDependencies(List dependencies, Filter artifactFilter) {
    _dependencies = dependencies;
        // collect list of artifacts
        _artifacts = new ArrayList();
        for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
      IvyNode dependency = (IvyNode) iter.next();
      if (!dependency.isCompletelyEvicted() && !dependency.hasProblem()) {
        _artifacts.addAll(Arrays.asList(dependency.getSelectedArtifacts(artifactFilter)));
      }
      // update the configurations reports with the dependencies
      // these reports will be completed later with download information, if any
      String[] dconfs = dependency.getRootModuleConfigurations();
      for (int j = 0; j < dconfs.length; j++) {
        ConfigurationResolveReport configurationReport = getConfigurationReport(dconfs[j]);
        if (configurationReport != null) {
          configurationReport.addDependency(dependency);
        }
View Full Code Here

   */
  public List getModuleIds() {
    List ret = new ArrayList();
    List sortedDependencies = new ArrayList(_dependencies);
    for (Iterator iter = sortedDependencies.iterator(); iter.hasNext();) {
      IvyNode dependency = (IvyNode) iter.next();
      ModuleId mid = dependency.getResolvedId().getModuleId();
      if (!ret.contains(mid)) {
        ret.add(mid);
      }
    }
    return ret;
View Full Code Here

        ModuleRevisionId resolvedMrid = mrid;
       
        // first check if this dependency has not yet been resolved
        if (getSettings().getVersionMatcher().isDynamic(mrid)) {
            resolvedMrid = ModuleRevisionId.newInstance(mrid, ivyRef.getRevision());
            IvyNode node = getSystemNode(data, resolvedMrid);
            if (node != null && node.getModuleRevision() != null) {
                // this revision has already be resolved : return it
                if (node.getDescriptor() != null && node.getDescriptor().isDefault()) {
                    Message.verbose("\t"+getName()+": found already resolved revision: "+resolvedMrid+": but it's a default one, maybe we can find a better one");
                } else {
                    Message.verbose("\t"+getName()+": revision already resolved: "+resolvedMrid);
                    return searchedRmr(node.getModuleRevision());
                }
            }
        }
       
        // now let's see if we can find it in cache and if it is up to date
View Full Code Here

               
                saxHandler.startDocument();
                saxHandler.startElement(null, "modules", "modules", new AttributesImpl());

                for (int i = 0; i < dependencies.length; i++) {
                    IvyNode dependency = dependencies[i];
                    if (dependency.getModuleRevision() == null || dependency.isCompletelyEvicted()) {
                      continue;
                    }

                    startModule(saxHandler, dependency);

                    Set artifactsOfModuleRev = (Set) moduleRevToArtifactsMap.get(dependency.getModuleRevision().getId());
                    if (artifactsOfModuleRev != null) {
                        for (Iterator iter = artifactsOfModuleRev.iterator(); iter.hasNext();) {
                            Artifact artifact = (Artifact) iter.next();

                            startArtifact(saxHandler, artifact);
View Full Code Here

            List dependencies = new ArrayList(report.getDependencies());
            Collections.sort(dependencies);
            if (dependencies.size() > 0) {
                String[] confs = report.getConfigurations();
                for (int i = 0; i < dependencies.size(); i++) {
                    IvyNode node = (IvyNode) dependencies.get(i);
                    if (node.isCompletelyEvicted()) {
                        continue;
                    }
                    List nodeConfs = new ArrayList(confs.length);
                    for (int j = 0; j < confs.length; j++) {
                        String conf = confs[j];
                        if (report.getConfigurationReport(conf).getModuleRevisionIds().contains(
                            node.getResolvedId())) {
                            nodeConfs.add(conf);
                        }
                    }
                    Message
                            .info("\t" + node + " from "
                                    + node.getModuleRevision().getResolver().getName() + " in "
                                    + nodeConfs);
                }
            }
        }
View Full Code Here

    @SuppressWarnings("unchecked") List<IvyNode> dependencies = report.getDependencies();

    // First pass - build the map of resolved nodes by revision id
    for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
      IvyNode node = (IvyNode) iter.next();
      if (node.getAllEvictingNodes() != null) {
        // Nodes that are evicted as a result of conf inheritance still appear
        // as dependencies, but with eviction data. They also appear as evictions.
        // We map them as evictions rather than dependencies.
        continue;
      }
      IvyNodeElement nodeElement = new IvyNodeElement();
      nodeElement.setModuleRevisionId(node.getResolvedId());
      resolvedNodes.put(node.getResolvedId(), nodeElement);
    }

    // Second pass - establish relationships between the resolved nodes
    for (Iterator iter = dependencies.iterator(); iter.hasNext();) {
      IvyNode node = (IvyNode) iter.next();
      if (node.getAllEvictingNodes() != null) {
        continue; // see note above
      }

      IvyNodeElement nodeElement = resolvedNodes.get(node.getResolvedId());
      IvyNodeCallers.Caller[] callers = node.getAllRealCallers();
      for (int i = 0; i < callers.length; i++) {
        IvyNodeElement caller = resolvedNodes.get(callers[i].getModuleRevisionId());
        if (caller != null) {
          nodeElement.addCaller(caller);
          nodeElement.setCallerConfigurations(caller, callers[i].getCallerConfigurations());
        }
      }
    }

    IvyNode[] evictions = report.getEvictedNodes();
    for (int i = 0; i < evictions.length; i++) {
      IvyNode eviction = evictions[i];
      IvyNodeElement evictionElement = new IvyNodeElement();
      evictionElement.setModuleRevisionId(eviction.getResolvedId());
      evictionElement.setEvicted(true);

      IvyNodeCallers.Caller[] callers = eviction.getAllCallers();
      for (int j = 0; j < callers.length; j++) {
        IvyNodeElement caller = resolvedNodes.get(callers[j].getModuleRevisionId());
        if (caller != null) {
          evictionElement.addCaller(caller);
          evictionElement.setCallerConfigurations(caller, callers[j].getCallerConfigurations());
View Full Code Here

        ModuleRevisionId resolvedMrid = mrid;

        // first check if this dependency has not yet been resolved
        if (getSettings().getVersionMatcher().isDynamic(mrid)) {
            resolvedMrid = ModuleRevisionId.newInstance(mrid, mdRef.getRevision());
            IvyNode node = data.getNode(resolvedMrid);
            if (node != null && node.getModuleRevision() != null) {
                // this revision has already be resolved : return it
                if (node.getDescriptor() != null && node.getDescriptor().isDefault()) {
                    Message.verbose("\t" + getName() + ": found already resolved revision: "
                            + resolvedMrid
                            + ": but it's a default one, maybe we can find a better one");
                } else {
                    Message.verbose("\t" + getName() + ": revision already resolved: "
                            + resolvedMrid);
                    node.getModuleRevision().getReport().setSearched(true);
                    return node.getModuleRevision();
                }
            }
        }

        Artifact moduleArtifact = parser.getMetadataArtifact(resolvedMrid, mdRef.getResource());
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.resolve.IvyNode

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.