/* (non-Javadoc)
@see com.tobedevoured.naether.api.Naether#addDependency(org.apache.maven.model.Dependency)
196461
public void addDependency(org.apache.maven.model.Dependency projectDependency) {
        log.debug( "Adding dependency: {}", projectDependency );
        
        DefaultArtifact artifact = null;
        
        if ( Const.TEST.equals( projectDependency.getType() ) || Const.TEST_JAR.equals( projectDependency.getType() ) ) {
            
            ArtifactType artifactType = new DefaultArtifactType( Const.TEST_JAR, Const.JAR, Const.TEST_JAR, null );
            
            artifact = new DefaultArtifact( projectDependency.getGroupId(), projectDependency.getArtifactId(),
                    null, Const.JAR, projectDependency.getVersion(), artifactType );
        } else {
            artifact = new DefaultArtifact( projectDependency.getGroupId(), projectDependency.getArtifactId(),
                    null, Const.JAR, projectDependency.getVersion() );
        }
        
        Dependency dependency = new Dependency( artifact , projectDependency.getScope());
        dependency.setOptional( projectDependency.isOptional() );
        
        List<Exclusion> exclusions = new ArrayList<Exclusion>();
        for ( org.apache.maven.model.Exclusion projectExclusion : projectDependency.getExclusions() ) {
            exclusions.add( new Exclusion(projectExclusion.getGroupId(), projectExclusion.getArtifactId(), "*", "*") );            
        }
        log.debug( "Exclusion: {}", exclusions );
        dependency = dependency.setExclusions( exclusions );
        
        dependencies.add( dependency );
    }
551919
public ItemRequest<Task> addDependencies(String task) {
    
        String path = String.format("/tasks/%s/addDependencies", task);
        return new ItemRequest<Task>(this, Task.class, path, "POST");
    }
1181116
static void addPropertyToDependencyList(List<AccessibleObject> orderedList, Map<String, AccessibleObject> props, Stack<AccessibleObject> stack, AccessibleObject obj) {
    
    	if (orderedList.contains(obj))
    		return ;
    	
    	if (stack.search(obj) > 0) {
    		throw new RuntimeException("Deadlock in @Property dependency processing") ;
    	}
    	// record the fact that we are processing obj
    	stack.push(obj) ;
    	// process dependencies for this object before adding it to the list
    	Property annotation = obj.getAnnotation(Property.class) ;
    	String dependsClause = annotation.dependsUpon() ;
    	StringTokenizer st = new StringTokenizer(dependsClause, ",") ;
    	while (st.hasMoreTokens()) {
    		String token = st.nextToken().trim();
    		AccessibleObject dep = props.get(token) ;
    		// if null, throw exception 
    		addPropertyToDependencyList(orderedList, props, stack, dep) ;
    	}
    	// indicate we're done with processing dependencies
    	stack.pop() ;
    	// we can now add in dependency order
    	orderedList.add(obj) ;
    }
1209710
public function addDependency(string $dependencyName): self
    {
        if (!property_exists($this->loadInfos, 'require')) {
            $this->loadInfos->require = [];
        }
        
        if (!is_array($this->loadInfos->require)) {
            $this->loadInfos->require = [$this->loadInfos->require];
        }
        
        $this->loadInfos->require[] = $dependencyName;
        
        return $this;
    }
233915
public void addRule(IntDependency dependency, double count) {
    if ( ! directional) {
      dependency = new IntDependency(dependency.head, dependency.arg, false, dependency.distance);
    }
    if (verbose) System.err.println("Adding dep " + dependency);
    //    coreDependencies.incrementCount(dependency, count);
    /*new IntDependency(dependency.head.word,
                                        dependency.head.tag,
                                        dependency.arg.word,
                                        dependency.arg.tag,
                                        dependency.leftHeaded,
                                        dependency.distance), count);
    */
    expandDependency(dependency, count);
    // System.err.println("stopCounter: " + stopCounter);
    // System.err.println("argCounter: " + argCounter);
  }
136466
public function addNode(DependencyNode $node)
    {
        if (!$this->dependencies->contains($node)) {
            $this->dependencies->attach($node, new ArrayObject());
            $this->nodes[] = $node;

            foreach ($node->getDependencies() as $depency) {
                $this->addDependency($node, $depency);
            }
        }
    }
1244232
public void addDocumentDependency(CmsObject cms, CmsDocumentDependency resDeps) {

        if (resDeps != null) {
            m_doc.addField(CmsSearchField.FIELD_DEPENDENCY_TYPE, resDeps.getType());
            if ((resDeps.getMainDocument() != null) && (resDeps.getType() != null)) {
                m_doc.addField(
                    CmsSearchField.FIELD_PREFIX_DEPENDENCY + resDeps.getType().toString(),
                    resDeps.getMainDocument().toDependencyString(cms));
            }
            for (CmsDocumentDependency dep : resDeps.getVariants()) {
                m_doc.addField(
                    CmsSearchField.FIELD_PREFIX_DEPENDENCY + dep.getType().toString(),
                    dep.toDependencyString(cms));
            }
            for (CmsDocumentDependency dep : resDeps.getAttachments()) {
                m_doc.addField(
                    CmsSearchField.FIELD_PREFIX_DEPENDENCY + dep.getType().toString(),
                    dep.toDependencyString(cms));
            }
        }
    }
280426
public void setDependencies(java.util.Collection<ApplicationDependencySummary> dependencies) {
        if (dependencies == null) {
            this.dependencies = null;
            return;
        }

        this.dependencies = new java.util.ArrayList<ApplicationDependencySummary>(dependencies);
    }
1115455
@Override
    public RESOLVESTAGETYPE addDependencies(final Collection<MavenDependency> dependencies)
        throws IllegalArgumentException {
        if (dependencies == null) {
            throw new IllegalArgumentException("dependencies must be provided");
        }
        for (final MavenDependency dep : dependencies) {
            this.addDependency(dep);
        }
        return this.covarientReturn();
    }
674019
public void addDependency(String notation, String scope ) {
        Map<String, String> notationMap = Notation.parse(notation);
        Dependency dependency = new Dependency();
        dependency.setGroupId(notationMap.get("groupId"));
        dependency.setArtifactId(notationMap.get("artifactId"));
        dependency.setType(notationMap.get("type"));
        dependency.setVersion(notationMap.get("version"));
        dependency.setScope( scope );
        addDependency(dependency);
    }
395945
public void addDependency(String notation, String scope) {
        log.debug("Add dep {} {}", notation, scope);
        
        DefaultArtifact artifact = new DefaultArtifact( notation );
        
        if ( Const.TEST.equals( artifact.getClassifier() ) || Const.TEST_JAR.equals( artifact.getClassifier() ) ) {
            
            ArtifactType artifactType = new DefaultArtifactType( Const.TEST_JAR, Const.JAR, Const.TEST_JAR, null );
            
            artifact = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                    null, Const.JAR, artifact.getBaseVersion(), artifactType );
        }
        Dependency dependency = new Dependency(artifact, scope);
        addDependency(dependency);
    }
666328
protected void addDependenciesRecursively(Namespace namespace, List<Namespace> namespaceList, String dependencyId, List<String> extendedDependencies) throws XmlException {
        if(extendedDependencies.contains(dependencyId)) {
            return;
        }
        if(namespace.getId().equals(dependencyId)) {
            throw new XmlException("Circular dependency found in " + namespace.getId());
        }

        Namespace dependency = find(namespaceList, dependencyId);
        extendedDependencies.add(dependency.getId());
        for(String indirectDependencyId: dependency.getDirectDependencyIds()) {
            addDependenciesRecursively(namespace, namespaceList, indirectDependencyId, extendedDependencies);
        }
    }
181903
public function addDependency($dep)
    {
        if (is_array($dep)) {
            $this->dependencies = array_merge($this->dependencies, $dep);
        } else {
            $this->dependencies[] = $dep;
        }
    }
958440
public DependencyList add(PersistentDependency dependency)
  {
    if (dependency == this)
      throw new IllegalArgumentException("Can't add self as a dependency.");
    
    if (! _dependencyList.contains(dependency))
      _dependencyList.add(dependency);

    // server/1d0w
    // XXX: _lastCheckTime = 0;

    return this;
  }
1215938
public void addVariant(CmsDocumentDependency dep) {

        // check if already exists
        for (CmsDocumentDependency lang : m_variants) {
            if (lang.getLocale().equals(dep.getLocale())) {
                return;
            }
        }
        dep.setType(DependencyType.variant);
        m_variants.add(dep);
        addDependency(dep);
    }
1190703
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Plugin loading happens only once on Jenkins startup")
    protected static void addDependencies(URL hpiResUrl, String fromPath, Set<URL> dependencySet) throws URISyntaxException, MalformedURLException {
        if (dependencySet.contains(hpiResUrl)) {
            return;
        }

        Manifest manifest = parsePluginManifest(hpiResUrl);
        String dependencySpec = manifest.getMainAttributes().getValue("Plugin-Dependencies");
        if (dependencySpec != null) {
            String[] dependencyTokens = dependencySpec.split(",");
            ServletContext context = Jenkins.getActiveInstance().servletContext;

            for (String dependencyToken : dependencyTokens) {
                if (dependencyToken.endsWith(";resolution:=optional")) {
                    // ignore optional dependencies
                    continue;
                }

                String[] artifactIdVersionPair = dependencyToken.split(":");
                String artifactId = artifactIdVersionPair[0];
                VersionNumber dependencyVersion = new VersionNumber(artifactIdVersionPair[1]);

                PluginManager manager = Jenkins.getActiveInstance().getPluginManager();
                VersionNumber installedVersion = manager.getPluginVersion(manager.rootDir, artifactId);
                if (installedVersion != null && !installedVersion.isOlderThan(dependencyVersion)) {
                    // Do not downgrade dependencies that are already installed.
                    continue;
                }

                URL dependencyURL = context.getResource(fromPath + "/" + artifactId + ".hpi");

                if (dependencyURL == null) {
                    // Maybe bundling has changed .jpi files
                    dependencyURL = context.getResource(fromPath + "/" + artifactId + ".jpi");
                }

                if (dependencyURL != null) {
                    // And transitive deps...
                    addDependencies(dependencyURL, fromPath, dependencySet);
                    // And then add the current plugin
                    dependencySet.add(dependencyURL);
                }
            }
        }
    }
1054440
protected String addDependency(TaskGroup.HasTaskGroup dependency) {
        Objects.requireNonNull(dependency);
        this.taskGroup().addDependencyTaskGroup(dependency.taskGroup());
        return dependency.taskGroup().key();
    }