Package com.aspectran.core.context.env
Class EnvironmentProfiles
- java.lang.Object
-
- com.aspectran.core.context.env.EnvironmentProfiles
-
public class EnvironmentProfiles extends java.lang.Object
Environment profiles provide baseline information for applications to recognize different execution environments. e.g. development, test, production etc.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACTIVE_PROFILES_PROPERTY_NAME
Name of property to set to specify active profiles: "aspectran.profiles.active".static java.lang.String
DEFAULT_PROFILES_PROPERTY_NAME
Name of property to set to specify profiles active by default: "aspectran.profiles.default".
-
Constructor Summary
Constructors Constructor Description EnvironmentProfiles()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsProfiles(java.lang.String... profiles)
java.lang.String[]
getActiveProfiles()
java.lang.String[]
getDefaultProfiles()
void
setActiveProfiles(java.lang.String... profiles)
Specify the set of profiles active for thisEnvironment
.void
setDefaultProfiles(java.lang.String... profiles)
Specify the set of profiles to be made active by default if no other profiles are explicitly made active throughsetActiveProfiles(java.lang.String...)
.protected void
validateProfile(java.lang.String profile)
Validate the given profile, called internally prior to adding to the set of active or default profiles.
-
-
-
Field Detail
-
ACTIVE_PROFILES_PROPERTY_NAME
public static final java.lang.String ACTIVE_PROFILES_PROPERTY_NAME
Name of property to set to specify active profiles: "aspectran.profiles.active". Value may be comma delimited.- See Also:
- Constant Field Values
-
DEFAULT_PROFILES_PROPERTY_NAME
public static final java.lang.String DEFAULT_PROFILES_PROPERTY_NAME
Name of property to set to specify profiles active by default: "aspectran.profiles.default". Value may be comma delimited.- See Also:
- Constant Field Values
-
-
Method Detail
-
getActiveProfiles
public java.lang.String[] getActiveProfiles()
-
setActiveProfiles
public void setActiveProfiles(java.lang.String... profiles)
Specify the set of profiles active for thisEnvironment
. Profiles are evaluated during the ActivityContext configuration to determine whether configuration settings or rules should be registered.Any existing active profiles will be replaced with the given arguments; call with zero arguments to clear the current set of active profiles.
- Parameters:
profiles
- the set of profiles active- Throws:
java.lang.IllegalArgumentException
- if any profile is null, empty or whitespace-only- See Also:
setDefaultProfiles(java.lang.String...)
-
getDefaultProfiles
public java.lang.String[] getDefaultProfiles()
-
setDefaultProfiles
public void setDefaultProfiles(java.lang.String... profiles)
Specify the set of profiles to be made active by default if no other profiles are explicitly made active throughsetActiveProfiles(java.lang.String...)
.Calling this method removes overrides any reserved default profiles that may have been added during construction of the environment.
- Parameters:
profiles
- the set of profiles to be made active by default
-
acceptsProfiles
public boolean acceptsProfiles(java.lang.String... profiles)
-
validateProfile
protected void validateProfile(java.lang.String profile)
Validate the given profile, called internally prior to adding to the set of active or default profiles.Subclasses may override to impose further restrictions on profile syntax.
- Parameters:
profile
- the given profile- Throws:
java.lang.IllegalArgumentException
- if the profile is null, empty, whitespace-only or begins with the profile NOT operator (!)- See Also:
acceptsProfiles(java.lang.String...)
,setDefaultProfiles(java.lang.String...)
-
-