@Override public void setActiveProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); if (logger.isDebugEnabled()) { logger.debug("Activating profiles " + Arrays.asList(profiles)); } synchronized (this.activeProfiles) { this.activeProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.activeProfiles.add(profile); } } }
/** * Specify the set of profiles to be made active by default if no other profiles * are explicitly made active through {@link #setActiveProfiles}. * <p>Calling this method removes overrides any reserved default profiles * that may have been added during construction of the environment. * @see #AbstractEnvironment() * @see #getReservedDefaultProfiles() */ @Override public void setDefaultProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); synchronized (this.defaultProfiles) { this.defaultProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.defaultProfiles.add(profile); } } }
@Override public void addActiveProfile(String profile) { if (logger.isDebugEnabled()) { logger.debug("Activating profile '" + profile + "'"); } validateProfile(profile); doGetActiveProfiles(); synchronized (this.activeProfiles) { this.activeProfiles.add(profile); } }
/** * Return whether the given profile is active, or if active profiles are empty * whether the profile should be active by default. * @throws IllegalArgumentException per {@link #validateProfile(String)} */ protected boolean isProfileActive(String profile) { validateProfile(profile); Set<String> currentActiveProfiles = doGetActiveProfiles(); return (currentActiveProfiles.contains(profile) || (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile))); }
@Override public void setActiveProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); if (logger.isDebugEnabled()) { logger.debug("Activating profiles " + Arrays.asList(profiles)); } synchronized (this.activeProfiles) { this.activeProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.activeProfiles.add(profile); } } }
/** * Specify the set of profiles to be made active by default if no other profiles * are explicitly made active through {@link #setActiveProfiles}. * <p>Calling this method removes overrides any reserved default profiles * that may have been added during construction of the environment. * @see #AbstractEnvironment() * @see #getReservedDefaultProfiles() */ @Override public void setDefaultProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); synchronized (this.defaultProfiles) { this.defaultProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.defaultProfiles.add(profile); } } }
@Override public void addActiveProfile(String profile) { if (logger.isDebugEnabled()) { logger.debug("Activating profile '" + profile + "'"); } validateProfile(profile); doGetActiveProfiles(); synchronized (this.activeProfiles) { this.activeProfiles.add(profile); } }
@Override protected void validateProfile(String profile) { super.validateProfile(profile); if (profile.contains("-")) { throw new IllegalArgumentException( "Invalid profile [" + profile + "]: must not contain dash character"); } } };
/** * Return whether the given profile is active, or if active profiles are empty * whether the profile should be active by default. * @throws IllegalArgumentException per {@link #validateProfile(String)} */ protected boolean isProfileActive(String profile) { validateProfile(profile); Set<String> currentActiveProfiles = doGetActiveProfiles(); return (currentActiveProfiles.contains(profile) || (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile))); }
public void addActiveProfile(String profile) { if (this.logger.isDebugEnabled()) { this.logger.debug(format("Activating profile '%s'", profile)); } this.validateProfile(profile); this.activeProfiles.add(profile); }
/** * {@inheritDoc} * <p>Calling this method removes overrides any reserved default profiles * that may have been added during construction of the environment. * @see #AbstractEnvironment() * @see #getReservedDefaultProfiles() */ public void setDefaultProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); this.defaultProfiles.clear(); for (String profile : profiles) { this.validateProfile(profile); this.defaultProfiles.add(profile); } }
public boolean acceptsProfiles(String... profiles) { Assert.notEmpty(profiles, "Must specify at least one profile"); boolean activeProfileFound = false; Set<String> activeProfiles = this.doGetActiveProfiles(); Set<String> defaultProfiles = this.doGetDefaultProfiles(); for (String profile : profiles) { this.validateProfile(profile); if (activeProfiles.contains(profile) || (activeProfiles.isEmpty() && defaultProfiles.contains(profile))) { activeProfileFound = true; break; } } return activeProfileFound; }
@Override public void setActiveProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); if (logger.isDebugEnabled()) { logger.debug("Activating profiles " + Arrays.asList(profiles)); } synchronized (this.activeProfiles) { this.activeProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.activeProfiles.add(profile); } } }
@Override public void setActiveProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); if (logger.isDebugEnabled()) { logger.debug("Activating profiles " + Arrays.asList(profiles)); } synchronized (this.activeProfiles) { this.activeProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.activeProfiles.add(profile); } } }
@Override public void addActiveProfile(String profile) { if (logger.isDebugEnabled()) { logger.debug("Activating profile '" + profile + "'"); } validateProfile(profile); doGetActiveProfiles(); synchronized (this.activeProfiles) { this.activeProfiles.add(profile); } }
/** * Specify the set of profiles to be made active by default if no other profiles * are explicitly made active through {@link #setActiveProfiles}. * <p>Calling this method removes overrides any reserved default profiles * that may have been added during construction of the environment. * @see #AbstractEnvironment() * @see #getReservedDefaultProfiles() */ @Override public void setDefaultProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); synchronized (this.defaultProfiles) { this.defaultProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.defaultProfiles.add(profile); } } }
/** * Specify the set of profiles to be made active by default if no other profiles * are explicitly made active through {@link #setActiveProfiles}. * <p>Calling this method removes overrides any reserved default profiles * that may have been added during construction of the environment. * @see #AbstractEnvironment() * @see #getReservedDefaultProfiles() */ @Override public void setDefaultProfiles(String... profiles) { Assert.notNull(profiles, "Profile array must not be null"); synchronized (this.defaultProfiles) { this.defaultProfiles.clear(); for (String profile : profiles) { validateProfile(profile); this.defaultProfiles.add(profile); } } }
@Override public void addActiveProfile(String profile) { if (logger.isDebugEnabled()) { logger.debug("Activating profile '" + profile + "'"); } validateProfile(profile); doGetActiveProfiles(); synchronized (this.activeProfiles) { this.activeProfiles.add(profile); } }
/** * Return whether the given profile is active, or if active profiles are empty * whether the profile should be active by default. * @throws IllegalArgumentException per {@link #validateProfile(String)} */ protected boolean isProfileActive(String profile) { validateProfile(profile); Set<String> currentActiveProfiles = doGetActiveProfiles(); return (currentActiveProfiles.contains(profile) || (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile))); }
/** * Return whether the given profile is active, or if active profiles are empty * whether the profile should be active by default. * @throws IllegalArgumentException per {@link #validateProfile(String)} */ protected boolean isProfileActive(String profile) { validateProfile(profile); Set<String> currentActiveProfiles = doGetActiveProfiles(); return (currentActiveProfiles.contains(profile) || (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile))); }