This class is the base of all ProjectStages. A ProjectStage identifies the environment the application currently runs in. It provides the same functionality as the JSF-2 ProjectStage but has a few additional benefits:
Technically this is kind of a 'dynamic enum'.
The following ProjectStages are provided by default
The following resolution mechanism is used to determine the current ProjectStage:
Adding a new ProjectStage is done via the {@link java.util.ServiceLoader} mechanism. A class deriving from {@link ProjectStage}must be provided and used for creating a single static instance of it.
Custom ProjectStages can be implemented by writing anonymous ProjectStage members into a registered {@link ProjectStageHolder} as shown in the followingsample:
package org.apache.deltaspike.test.core.api.projectstage; public class TestProjectStages implements ProjectStageHolder { public static final class MyOwnProjectStage extends ProjectStage {}; public static final MyOwnProjectStage MyOwnProjectStage = new MyOwnProjectStage(); public static final class MyOtherProjectStage extends ProjectStage {}; public static final MyOtherProjectStage MyOtherProjectStage = new MyOtherProjectStage(); }
For activating those ProjectStages, you have to register this ProjectStageHolder class to get picked up via the java.util.ServiceLoader mechanism. Simply create a file
META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolderwhich contains the fully qualified class name of custom ProjectStageHolder implementation:
# this class now gets picked up by java.util.ServiceLoader org.apache.deltaspike.test.core.api.projectstage.TestProjectStages
You can use your own ProjectStages exactly the same way as all the ones provided by the system:
ProjectStage myOwnPs = ProjectStage.valueOf("MyOwnProjectStage"); if (myOwnPs.equals(MyOwnProjectStage.MyOwnProjectStage)) ...
Note: Please note that DeltaSpike will only find {@link ProjectStageHolder}s which are accessible by this very class. If you deploy the deltaspike-core jar to a shared EAR classloader, it will e.g. not be able to register ProjectStages defined in a web applications WEB-INF/classes directory!
This class is the base of all ProjectStages. A ProjectStage identifies the environment the application currently runs in. It provides the same functionality as the JSF-2 ProjectStage but has a few additional benefits:
Technically this is kind of a 'dynamic enum'.
The following ProjectStages are provided by default
The following resolution mechanism is used to determine the current ProjectStage:
Adding a new ProjectStage is done via the {@link java.util.ServiceLoader} mechanism. A class deriving from {@link ProjectStage}must be provided and used for creating a single static instance of it.
Custom ProjectStages can be implemented by writing anonymous ProjectStage members into a registered {@link ProjectStageHolder} as shown in the followingsample:
package org.apache.myfaces.extensions.cdi.test.api.projectstage; public class MyProjectStages implements ProjectStageHolder { public static final class MyOwnProjectStage extends ProjectStage {}; public static final MyOwnProjectStage MyOwnProjectStage = new MyOwnProjectStage(); public static final class MyOtherProjectStage extends ProjectStage {}; public static final MyOtherProjectStage MyOtherProjectStage = new MyOtherProjectStage(); }
For activating those projectstages, you have to register this ProjectStageHolder class to get picked up via the java.util.ServiceLoader mechanism. Simply create a file
META-INF/services/org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStageHolderwhich contains the fully qualified class name of custom ProjectStageHolder implementation:
# this class now get's picked up by java.util.ServiceLoader org.apache.myfaces.extensions.cdi.core.test.api.projectstage.MyProjectStages
You can use your own ProjectStages exactly the same way as all the ones provided by the system:
ProjectStage myOwnPs = ProjectStage.valueOf("MyOwnProjectStage"); if (myOwnPs.equals(MyOwnProjectStage.MyOwnProjectStage)) ...
|
|