Return the source {@link Artifact} to repackage. If a classifier is specified and
an artifact with that classifier exists, it is used. Otherwise, the main artifact
is used.
@return the source artifact to repackage
192495
private Artifact getSourceArtifact() {
		Artifact sourceArtifact = getArtifact(this.classifier);
		return (sourceArtifact != null) ? sourceArtifact : this.project.getArtifact();
	}
626332
public ConfigurationProvider build() {
    LOG.info("Initializing ConfigurationProvider with "
        + configurationSource.getClass().getCanonicalName() + " source, "
        + reloadStrategy.getClass().getCanonicalName() + " reload strategy and "
        + environment.getClass().getCanonicalName() + " environment");

    final CachedConfigurationSource cachedConfigurationSource = new CachedConfigurationSource(configurationSource);
    if (metricRegistry != null) {
      configurationSource = new MeteredConfigurationSource(metricRegistry, prefix, cachedConfigurationSource);
    }
    cachedConfigurationSource.init();

    Reloadable reloadable = () -> cachedConfigurationSource.reload(environment);

    if (metricRegistry != null) {
      reloadable = new MeteredReloadable(metricRegistry, prefix, reloadable);
    }
    reloadable.reload();
    reloadStrategy.register(reloadable);

    SimpleConfigurationProvider configurationProvider = new SimpleConfigurationProvider(cachedConfigurationSource, environment);
    if (metricRegistry != null) {
      return new MeteredConfigurationProvider(metricRegistry, prefix, configurationProvider);
    }

    return configurationProvider;
  }
1148485
public SimpleFeatureSource getFeatureSource() throws LayerException {
		try {
			if (dataStore instanceof WFSDataStore) {
				return dataStore.getFeatureSource(featureSourceName.replace(":", "_"));
			} else {
				return dataStore.getFeatureSource(featureSourceName);
			}
		} catch (IOException e) {
			throw new LayerException(e, ExceptionCode.FEATURE_MODEL_PROBLEM,
					"Cannot find feature source " + featureSourceName);
		} catch (NullPointerException e) {
			throw new LayerException(e, ExceptionCode.FEATURE_MODEL_PROBLEM,
					"Cannot find feature source " + featureSourceName);
		}
	}
331606
public final Parser<String> source() {
    return new Parser<String>() {
      @Override boolean apply(ParseContext ctxt) {
        int begin = ctxt.getIndex();
        if (!Parser.this.apply(ctxt)) {
          return false;
        }
        ctxt.result = ctxt.source.subSequence(begin, ctxt.getIndex()).toString();
        return true;
      }
      @Override public String toString() {
        return "source";
      }
    };
  }
1332523
public String getName()
    {
        if ( name == null )
        {
            name = MessageFormat.format( "{0}-{1}{2}.{3}", new Object[]{ artifactId, getTimestampVersion(),
                ( classifier == null ? "" : "-" + classifier ), type } );
        }
        return name;
    }
176940
public final Parser<WithSource<T>> withSource() {
    return new Parser<WithSource<T>>() {
      @Override boolean apply(ParseContext ctxt) {
        int begin = ctxt.getIndex();
        if (!Parser.this.apply(ctxt)) {
          return false;
        }
        String source = ctxt.source.subSequence(begin, ctxt.getIndex()).toString();
        @SuppressWarnings("unchecked")
        WithSource<T> withSource = new WithSource<T>((T) ctxt.result, source);
        ctxt.result = withSource;
        return true;
      }
      @Override public String toString() {
        return Parser.this.toString();
      }
    };
  }
1087046
@SuppressWarnings("rawtypes")
    public List<File> downloadArtifacts( List artifactsOrNotations ) throws NaetherException {
        
        List<Artifact> artifacts = new ArrayList<Artifact>();
        
        for ( Object artifactsOrNotation : artifactsOrNotations ) {
            if ( artifactsOrNotation != null ) {
                if ( artifactsOrNotation instanceof String ) {
                    artifacts.add( new DefaultArtifact( (String) artifactsOrNotation ) );
                } else if ( artifactsOrNotation instanceof Artifact ) {
                    artifacts.add( (Artifact)artifactsOrNotation );
                } else {
                    throw new NaetherException( "Only String notations or Artifact instances allowed. Found " + artifactsOrNotation.getClass() );
                }
            } else {
                log.warn( "Null found in list of artifacts to download" );
            }
        }
        
        List<File> files = new ArrayList<File>();
        
        for ( Artifact artifact : artifacts ) {
            
            log.debug( "Downloading {}", artifact );
            
            ArtifactRequest artifactRequest = new ArtifactRequest();
            artifactRequest.setArtifact( artifact );
            for ( RemoteRepository repo : this.getRemoteRepositories() ) {
                artifactRequest.addRepository( repo );
            }
    
            RepositoryClient repoClient = new RepositoryClient(this.getLocalRepoPath());
            
            ArtifactResult artifactResult = null;
            try {
                artifactResult = repoClient.resolveArtifact(artifactRequest );
            } catch (ArtifactResolutionException e) {
                throw new ResolveException(e);
            }
    
            Artifact downloadedArtifact = artifactResult.getArtifact();
            files.add( downloadedArtifact.getFile() );
        }
        
        return files;
    }
800070
public Collator getCollator() {
        if (collator == null) {
            return guessCollator();
        }
        try {
            return (Collator) collator.clone();  // clone for safety
        } catch (CloneNotSupportedException e) {
            throw new ICUCloneNotSupportedException("Error in cloning collator", e);
        }
    }
1148652
@Override
	public Result<Artifacts> fromArtifacts(Result<List<Data>> lArtiDAO) {
		if(lArtiDAO.isOK()) {
			Artifacts artis = new Artifacts();
			for(ArtiDAO.Data arti : lArtiDAO.value) {
				Artifact a = new Artifact();
				a.setMechid(arti.mechid);
				a.setMachine(arti.machine);
				a.setSponsor(arti.sponsor);
				a.setAppName(arti.appName);
				a.setCa(arti.ca);
				a.setDir(arti.dir);
				a.getType().addAll(arti.type(false));
				a.setOsUser(arti.os_user);
				a.setRenewDays(arti.renewDays);
				a.setNotification(arti.notify);
				artis.getArtifact().add(a);
			}
			return Result.ok(artis);
		} else {
			return Result.err(lArtiDAO);
		}
	}
210789
protected ClassLoader getClassLoader(Set<Artifact> artifacts) throws Exception {
        Set<URL> classpathURLs = new LinkedHashSet<URL>();

        addCustomClasspaths(classpathURLs, true);

        // add ourselves to top of classpath
        URL mainClasses = new File(project.getBuild().getOutputDirectory()).toURI().toURL();
        getLog().debug("Adding to classpath : " + mainClasses);
        classpathURLs.add(mainClasses);

        for (Artifact artifact : artifacts) {
            File file = artifact.getFile();
            if (file != null) {
                classpathURLs.add(file.toURI().toURL());
            }
        }

        addCustomClasspaths(classpathURLs, false);

        if (logClasspath) {
            getLog().info("Classpath (" + classpathURLs.size() + " entries):");
            for (URL url : classpathURLs) {
                getLog().info("  " + url.getFile().toString());
            }
        }
        return new URLClassLoader(classpathURLs.toArray(new URL[classpathURLs.size()]));
    }
294494
public Class<? extends Supplier<RoutingHandler>> compileClass()
    {
        try {
            this.generateRoutes();

            log.debug("\n\nGenerated Class Source:\n\n" + this.sourceString);

            return CompilerUtils.CACHED_COMPILER.loadFromJava(packageName + "." + className, this.sourceString);

        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return null;
        }
    }
439306
protected SortedSources getSources() {
        SortedSources sources = new SortedSources(getUserSources());
        if (addDefaultSourcesFlag()) {
            sources.addAll(DefaultSources.getDefaultSources(getClassLoader()));
        }
        if (addDiscoveredSourcesFlag()) {
            sources.addAll(DefaultSources.getDiscoveredSources(getClassLoader()));
        }
        sources = sources.unmodifiable();
        return sources;
    }
758296
public String getURL()
    {
        validateNotEmpty( m_groupId, true, "Group" );
        validateNotEmpty( m_artifactId, true, "Artifact" );
        final StringBuilder url = new StringBuilder();
        url.append( "mvn:" ).append( m_groupId ).append( "/" ).append( m_artifactId );
        if( m_version != null || m_type != null || m_classifier != null )
        {
            url.append( "/" );
        }
        if( m_version != null )
        {
            url.append( m_version );
        }
        if( m_type != null || m_classifier != null )
        {
            url.append( "/" );
        }
        if( m_type != null )
        {
            url.append( m_type );
        }
        if( m_classifier != null )
        {
            url.append( "/" ).append( m_classifier );
        }
        return url.toString();
    }
1261071
public static Artifact unserializeArtifact(final String artifact) throws IOException {
		final ObjectMapper mapper = new ObjectMapper();
        mapper.disable(MapperFeature.USE_GETTERS_AS_SETTERS);
		return mapper.readValue(artifact, Artifact.class);
	}
428823
public ArtifactTypeRegistry artifactTypeRegistry() {
        DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
        stereotypes.add(new DefaultArtifactType("pom"));
        stereotypes.add(new DefaultArtifactType("maven-plugin", "jar", "", "java"));
        stereotypes.add(new DefaultArtifactType("jar", "jar", "", "java"));
        stereotypes.add(new DefaultArtifactType("ejb", "jar", "", "java"));
        stereotypes.add(new DefaultArtifactType("ejb-client", "jar", "client", "java"));
        stereotypes.add(new DefaultArtifactType("test-jar", "jar", "tests", "java"));
        stereotypes.add(new DefaultArtifactType("javadoc", "jar", "javadoc", "java"));
        stereotypes.add(new DefaultArtifactType("java-source", "jar", "sources", "java", false, false));
        stereotypes.add(new DefaultArtifactType("war", "war", "", "java", false, true));
        stereotypes.add(new DefaultArtifactType("ear", "ear", "", "java", false, true));
        stereotypes.add(new DefaultArtifactType("rar", "rar", "", "java", false, true));
        stereotypes.add(new DefaultArtifactType("par", "par", "", "java", false, true));
        return stereotypes;
    }
993786
def GetArtifact(self, name):
    
    self._CheckDirty()
    result = self._artifacts.get(name)
    if not result:
      raise rdf_artifacts.ArtifactNotRegisteredError(
          "Artifact %s missing from registry. You may need to sync the "
          "artifact repo by running make in the artifact directory." % name)
    return result
887972
@Override
    protected List<ChecksumFile> getFilesToProcess()
    {
        List<ChecksumFile> files = new LinkedList<ChecksumFile>();

        // Add project main artifact.
        if ( hasValidFile( project.getArtifact() ) )
        {
            files.add( new ChecksumFile( "", project.getArtifact().getFile(), project.getArtifact().getType(),null ) );
        }

        // Add projects attached.
        if ( project.getAttachedArtifacts() != null )
        {
            for ( Artifact artifact : (List<Artifact>) project.getAttachedArtifacts() )
            {
                if ( hasValidFile( artifact ) )
                {
                    files.add( new ChecksumFile( "", artifact.getFile(), artifact.getType(), artifact.getClassifier() ) );
                }
            }
        }
        return files;
    }