private List<String> getProfileIds( List<Profile> profiles ) { List<String> ids = new ArrayList<>( profiles.size() ); for ( Profile profile : profiles ) { ids.add( profile.getId() ); } return ids; }
/** * @see java.lang.Object#toString() */ public String toString() { return "Profile {id: " + getId() + ", source: " + getSource() + "}"; }
private void injectProfileActivations( Model model, Map<String, Activation> activations ) { for ( Profile profile : model.getProfiles() ) { Activation activation = profile.getActivation(); if ( activation == null ) { continue; } // restore activation profile.setActivation( activations.get( profile.getId() ) ); } }
private Map<String, Activation> getProfileActivations( Model model, boolean clone ) { Map<String, Activation> activations = new HashMap<>(); for ( Profile profile : model.getProfiles() ) { Activation activation = profile.getActivation(); if ( activation == null ) { continue; } if ( clone ) { activation = activation.clone(); } activations.put( profile.getId(), activation ); } return activations; }
public void addProfile( Profile profile ) { String profileId = profile.getId(); Profile existing = profilesById.get( profileId ); if ( existing != null ) { logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() + ") with new instance from source: " + profile.getSource() ); } profilesById.put( profile.getId(), profile ); Activation activation = profile.getActivation(); if ( activation != null && activation.isActiveByDefault() ) { activateAsDefault( profileId ); } }
public void addProfile( Profile profile ) { String profileId = profile.getId(); Profile existing = (Profile) profilesById.get( profileId ); if ( existing != null ) { container.getLogger().warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() + ") with new instance from source: " + profile.getSource() ); } profilesById.put( profile.getId(), profile ); Activation activation = profile.getActivation(); if ( activation != null && activation.isActiveByDefault() ) { activateAsDefault( profileId ); } }
+ profile.getId() + "'" );
+ profile.getId() + "'" );
throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': " + e.getMessage() );
throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': " + e.getMessage() );
.setMessage( "The property name is required to activate the profile " + profile.getId() ) .setLocation( property.getLocation( "" ) ) ); return false;
.setMessage( "Failed to determine Java version for profile " + profile.getId() ) .setLocation( activation.getLocation( "jdk" ) ) ); return false;
private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems ) { boolean isActive = false; for ( ProfileActivator activator : activators ) { if ( activator.presentInConfig( profile, context, problems ) ) { isActive = true; } } for ( ProfileActivator activator : activators ) { try { if ( activator.presentInConfig( profile, context, problems ) ) { isActive &= activator.isActive( profile, context, problems ); } } catch ( RuntimeException e ) { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Failed to determine activation for profile " + profile.getId() ) .setLocation( profile.getLocation( "" ) ) .setException( e ) ); return false; } } return isActive; }
.setMessage( "Failed to interpolate file location " + path + " for profile " + profile.getId() + ": " + e.getMessage() ) .setLocation( file.getLocation( missing ? "missing" : "exists" ) )
public static Profile cloneProfile( Profile src ) { if ( src == null ) { return null; } Profile result = new Profile(); cloneModelBaseFields( src, result ); result.setActivation( cloneActivation( src.getActivation() ) ); BuildBase resultBuild = null; if ( src.getBuild() != null ) { resultBuild = new BuildBase(); cloneBuildBaseFields( src.getBuild(), resultBuild ); } result.setBuild( resultBuild ); result.setId( src.getId() ); result.setSource( src.getSource() ); return result; }
String prefix = "profiles.profile[" + profile.getId() + "]"; if ( !profileIds.add( profile.getId() ) ) "must be unique but found duplicate profile with id " + profile.getId(), profile ); validate30RawProfileActivation( problems, profile.getActivation(), profile.getId(), prefix + ".activation", request );
profile.setId( modelProfile.getId() );