Package io.wcm.wcm.commons.util
Class RunMode
java.lang.Object
io.wcm.wcm.commons.util.RunMode
Sling run mode utility methods.
Most methods in this class are deprecated because SlingSettingsService is deprecated in recent AEM
versions. The OSGi service InstanceTypeService can be used instead.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandisableIfNoRunModeActive(Set<String> runModes, String[] allowedRunModes, org.osgi.service.component.ComponentContext componentContext, org.slf4j.Logger log) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy).static booleandisableIfNotAuthor(Set<String> runModes, org.osgi.service.component.ComponentContext componentContext, org.slf4j.Logger log) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy).static booleandisableIfNotPublish(Set<String> runModes, org.osgi.service.component.ComponentContext componentContext, org.slf4j.Logger log) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy).static booleanDeprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy).static booleanDeprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy).static booleanDeprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy).
-
Field Details
-
AUTHOR
Runmode for author instance- See Also:
-
PUBLISH
Runmode for publish instance- See Also:
-
-
Method Details
-
is
@Deprecated(since="1.0.4") public static boolean is(Set<String> runModes, String... expectedRunModes) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.Checks if given run mode is active.- Parameters:
runModes- Run modes for current instanceexpectedRunModes- Run mode(s) to check for- Returns:
- true if any of the given run modes is active
-
isAuthor
Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.Checks if context is running on author instance.- Parameters:
runModes- Run modes- Returns:
- true if "author" run mode is active
-
isPublish
Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.Checks if context is running on publish instance.- Parameters:
runModes- Run modes- Returns:
- true if "publish" run mode is active
-
disableIfNoRunModeActive
@Deprecated(since="1.0.4") public static boolean disableIfNoRunModeActive(Set<String> runModes, String[] allowedRunModes, org.osgi.service.component.ComponentContext componentContext, org.slf4j.Logger log) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.Use this to disable a component if none of its run modes are active. Component activation status is logged with DEBUG level. This method is a replacement for thecom.day.cq.commons.RunModeUtil#disableIfNoRunModeActive(RunMode, String[], ComponentContext, Logger)method which is deprecated.- Parameters:
runModes- Run modesallowedRunModes- Allowed run modescomponentContext- OSGI component contextlog- Logger- Returns:
- true if component was disabled
-
disableIfNotAuthor
@Deprecated(since="1.0.4") public static boolean disableIfNotAuthor(Set<String> runModes, org.osgi.service.component.ComponentContext componentContext, org.slf4j.Logger log) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.Use this to disable a component if the runmode "author" is not active. Component activation status is logged with DEBUG level. This method is a replacement for thecom.day.cq.commons.RunModeUtil#disableIfNoRunModeActive(RunMode, String[], ComponentContext, Logger)method which is deprecated.- Parameters:
runModes- Run modescomponentContext- OSGI component contextlog- Logger- Returns:
- true if component was disabled
-
disableIfNotPublish
@Deprecated(since="1.0.4") public static boolean disableIfNotPublish(Set<String> runModes, org.osgi.service.component.ComponentContext componentContext, org.slf4j.Logger log) Deprecated.Instead of directly using the run modes, it is better to make the component in question require a configuration (see OSGI Declarative Services Spec: configuration policy). In this case, a component gets only active if a configuration is available. Such a configuration can be put into the repository for the specific run mode.Use this to disable a component if the runmode "publish" is not active. Component activation status is logged with DEBUG level. This method is a replacement for thecom.day.cq.commons.RunModeUtil#disableIfNoRunModeActive(RunMode, String[], ComponentContext, Logger)method which is deprecated.- Parameters:
runModes- Run modescomponentContext- OSGI component contextlog- Logger- Returns:
- true if component was disabled
-