private static String getId( String gid, String aid, String type, String cls, String ver ) { return gid + ':' + aid + ':' + type + ( StringUtils.isNotEmpty( cls ) ? ':' + cls : "" ) + ':' + ver; }
public boolean hasClassifier() { return StringUtils.isNotEmpty( classifier ); }
public boolean hasClassifier() { return StringUtils.isNotEmpty( classifier ); }
private static String getMessage( Throwable error, String def ) { if ( error == null ) { return def; } String msg = error.getMessage(); if ( StringUtils.isNotEmpty( msg ) ) { return msg; } return getMessage( error.getCause(), def ); }
private PluginExecution findPluginExecution( String executionId, Collection<PluginExecution> executions ) { if ( StringUtils.isNotEmpty( executionId ) ) { for ( PluginExecution execution : executions ) { if ( executionId.equals( execution.getId() ) ) { return execution; } } } return null; }
private List<File> parseExtClasspath( CliRequest cliRequest ) { String extClassPath = cliRequest.userProperties.getProperty( EXT_CLASS_PATH ); if ( extClassPath == null ) { extClassPath = cliRequest.systemProperties.getProperty( EXT_CLASS_PATH ); } List<File> jars = new ArrayList<>(); if ( StringUtils.isNotEmpty( extClassPath ) ) { for ( String jar : StringUtils.split( extClassPath, File.pathSeparator ) ) { File file = resolveFile( new File( jar ), cliRequest.workingDirectory ); slf4jLogger.debug( " Included " + file ); jars.add( file ); } } return jars; }
private void addDom( Xpp3Dom parent, String childName, String childValue ) { if ( StringUtils.isNotEmpty( childValue ) ) { parent.addChild( newDom( childName, childValue ) ); } }
public void set( String goals ) { mojos = new ArrayList<>(); if ( StringUtils.isNotEmpty( goals ) ) { String[] mojoGoals = StringUtils.split( goals, "," ); for ( String mojoGoal: mojoGoals ) { LifecycleMojo lifecycleMojo = new LifecycleMojo(); lifecycleMojo.setGoal( mojoGoal.trim() ); mojos.add( lifecycleMojo ); } } }
private void appendForkInfo( MessageBuilder buffer, MojoDescriptor md ) { StringBuilder buff = new StringBuilder(); if ( StringUtils.isNotEmpty( md.getExecutePhase() ) ) { // forked phase if ( StringUtils.isNotEmpty( md.getExecuteLifecycle() ) ) { buff.append( '[' ); buff.append( md.getExecuteLifecycle() ); buff.append( ']' ); } buff.append( md.getExecutePhase() ); } else { // forked goal buff.append( ':' ); buff.append( md.getExecuteGoal() ); } buffer.strong( buff.toString() ); }
private CloseableHttpResponse execute(String requestUrl, String userName, String password) throws IOException { CloseableHttpResponse response; Proxy proxy = proxyConfig.getProxyForUrl(requestUrl); if (proxy != null) { LOGGER.info("Downloading via proxy " + proxy.toString()); return executeViaProxy(proxy, requestUrl); } else { LOGGER.info("No proxy was configured, downloading directly"); if (StringUtils.isNotEmpty(userName) && StringUtils.isNotEmpty(password)) { LOGGER.info("Using credentials (" + userName + ") from settings.xml"); // Auth target host URL aURL = new URL(requestUrl); HttpClientContext localContext = makeLocalContext(aURL); CredentialsProvider credentialsProvider = makeCredentialsProvider( aURL.getHost(), aURL.getPort(), userName, password); response = buildHttpClient(credentialsProvider).execute(new HttpGet(requestUrl),localContext); } else { response = buildHttpClient(null).execute(new HttpGet(requestUrl)); } } return response; }
private void debugDependencyRequirements( List<MojoExecution> mojoExecutions ) { Set<String> scopesToCollect = new TreeSet<>(); Set<String> scopesToResolve = new TreeSet<>(); for ( MojoExecution mojoExecution : mojoExecutions ) { MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired(); if ( StringUtils.isNotEmpty( scopeToCollect ) ) { scopesToCollect.add( scopeToCollect ); } String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired(); if ( StringUtils.isNotEmpty( scopeToResolve ) ) { scopesToResolve.add( scopeToResolve ); } } logger.debug( "Dependencies (collect): " + scopesToCollect ); logger.debug( "Dependencies (resolve): " + scopesToResolve ); }
/** * Update the progress */ public void progressUpdate(String layerId, String status, String progressMessage) { if (!batchMode && log.isInfoEnabled() && StringUtils.isNotEmpty(layerId)) { if (useAnsi) { updateAnsiProgress(layerId, status, progressMessage); } else { updateNonAnsiProgress(layerId); } flush(); } }
private void exposeContainerProps(String containerId) throws DockerAccessException { String propKey = getExposedPropertyKeyPart(); if (StringUtils.isNotEmpty(exposeContainerProps) && StringUtils.isNotEmpty(propKey)) { Container container = hub.getQueryService().getMandatoryContainer(containerId); String prefix = addDot(exposeContainerProps) + addDot(propKey); projectProperties.put(prefix + "id", containerId); String ip = container.getIPAddress(); if (StringUtils.isNotEmpty(ip)) { projectProperties.put(prefix + "ip", ip); } Map<String, String> nets = container.getCustomNetworkIpAddresses(); if (nets != null) { for (Map.Entry<String, String> entry : nets.entrySet()) { projectProperties.put(prefix + addDot("net") + addDot(entry.getKey()) + "ip", entry.getValue()); } } } }
private static String constructMessage( MojoExecution mojoExecution, Throwable cause ) { String message; if ( mojoExecution != null ) { message = "Execution " + mojoExecution.getExecutionId() + " of goal " + mojoExecution.getMojoDescriptor().getId() + " failed"; } else { message = "Mojo execution failed"; } if ( cause != null && StringUtils.isNotEmpty( cause.getMessage() ) ) { message += ": " + cause.getMessage(); } else { message += "."; } return message; }
protected boolean canDetectActivation( Profile profile ) { return profile.getActivation() != null && StringUtils.isNotEmpty( profile.getActivation().getJdk() ); }
protected boolean canDetectActivation( Profile profile ) { return profile.getActivation() != null && StringUtils.isNotEmpty( profile.getActivation().getJdk() ); }
private ExceptionSummary handle( ModelProblem problem, String projectId ) { if ( ModelProblem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 ) { String message = problem.getMessage(); String location = ModelProblemUtils.formatLocation( problem, projectId ); if ( StringUtils.isNotEmpty( location ) ) { message += " @ " + location; } return handle( message, problem.getException() ); } else { return null; } }
/** * Sign a request. Add the headers that authenticate the request. * * @param request The request to sign. * @param credentials The credentials to use when signing. * @param signingTime The invocation time to use; */ void sign(HttpRequest request, AuthConfig credentials, Date signingTime) { AwsSigner4Request sr = new AwsSigner4Request(region, service, request, signingTime); if(!request.containsHeader("X-Amz-Date")) { request.addHeader("X-Amz-Date", sr.getSigningDateTime()); } request.addHeader("Authorization", task4(sr, credentials)); final String securityToken = credentials.getAuth(); if (StringUtils.isNotEmpty(securityToken)) { request.addHeader("X-Amz-Security-Token", securityToken); } }
private void injectMirror( ArtifactRepository repository, Mirror mirror ) { if ( mirror != null ) { ArtifactRepository original = createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(), repository.getSnapshots(), repository.getReleases() ); repository.setMirroredRepositories( Collections.singletonList( original ) ); repository.setId( mirror.getId() ); repository.setUrl( mirror.getUrl() ); if ( StringUtils.isNotEmpty( mirror.getLayout() ) ) { repository.setLayout( getLayout( mirror.getLayout() ) ); } } }
private void injectMirror( ArtifactRepository repository, Mirror mirror ) { if ( mirror != null ) { ArtifactRepository original = createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(), repository.getSnapshots(), repository.getReleases() ); repository.setMirroredRepositories( Collections.singletonList( original ) ); repository.setId( mirror.getId() ); repository.setUrl( mirror.getUrl() ); if ( StringUtils.isNotEmpty( mirror.getLayout() ) ) { repository.setLayout( getLayout( mirror.getLayout() ) ); } } }