/** * @see ArtifactContext#getArtifactByID(String) */ public Artifact getArtifactByID( String id ) { NetDependenciesRepositoryImpl repository = (NetDependenciesRepositoryImpl) repositoryRegistry.find( "net-dependencies" ); repository.init( artifactFactory ); return repository.getArtifactByID( id ); }
/** * Returns a list of .NET dependencies as given within the net dependencies config file. This dependency list * is external to the pom file dependencies. This separation is necessary since some Java Maven plugins * - which themselves are necessary for building .NET applications - may have .NET executable dependencies that * have not been built yet and can't be resolved. * * @return a list of .NET dependencies as given within the net dependencies config file */ public List<Dependency> getDependencies() { return getDependenciesFor( null ); }
/** * @see NetDependenciesRepository#getDependenciesFor(java.util.List<npanday.artifact.NetDependencyMatchPolicy>) */ public List<Dependency> getDependenciesFor( List<NetDependencyMatchPolicy> matchPolicies ) { if ( matchPolicies == null ) { matchPolicies = new ArrayList<NetDependencyMatchPolicy>(); } List<Dependency> dependencies = new ArrayList<Dependency>(); for ( NetDependency netDependency : netDependencies ) { if ( isMatch( netDependency, matchPolicies ) ) { dependencies.add( netDependencyToDependency( netDependency ) ); } } return dependencies; }
/** * @see ArtifactContext#getArtifactsFor(String, String, String, String) */ public List<Artifact> getArtifactsFor( String groupId, String artifactId, String version, String type ) { NetDependenciesRepositoryImpl repository = (NetDependenciesRepositoryImpl) repositoryRegistry.find( "net-dependencies" ); if ( repository == null ) { logger.warn( "NPANDAY-000-001: Could not locate artifact (net dependencies repository not found): Group ID = " + groupId + ", Artifact ID = " + artifactId + ", Version = " + version + ", Type = " + type ); return new ArrayList<Artifact>(); } repository.init( artifactFactory ); List<Artifact> artifacts = repository.getArtifactsFor( groupId, artifactId, version, type ); for ( Artifact artifact : artifacts ) { logger.debug("NPANDAY-000-002: set file"); artifact.setFile( PathUtil.getUserAssemblyCacheFileFor( artifact, getLocalRepository() ) ); } return artifacts; }
/** * Returns the artifact associated with the specified id. * * @param id the artifact ID * @return the artifact associated with the specified id */ Artifact getArtifactByID( String id ) { for ( NetDependency netDependency : netDependencies ) { if ( netDependency.getId() != null && netDependency.getId().equals( id ) ) { return netDependencyToArtifact( netDependency ); } } return null; }
/** * Returns a list of artifacts that match the specified parameters. If the version or type parameters are null, * then the returned list will include all versions and types. * * @param groupId the group ID of the artifact to match. This value should not be null. * @param artifactId the artifact ID of the artifact to match. This value should not be null. * @param version the version if the artifact to match. * @param type the type of artifact to match * @return a list of artifacts that match the specified parameters */ List<Artifact> getArtifactsFor( String groupId, String artifactId, String version, String type ) { List<Artifact> artifacts = new ArrayList<Artifact>(); for ( NetDependency netDependency : netDependencies ) { if ( netDependency.getGroupId().equals( groupId ) && netDependency.getArtifactId().equals( artifactId ) && ( version == null || netDependency.getVersion().equals( version ) ) && ( type == null || netDependency.getType().equals( type ) ) ) { artifacts.add( netDependencyToArtifact( netDependency ) ); } } return artifacts; }