Thanks Dan, I think that makes sense!

Branch v2 has progressed, such that we now have a SPI for determinig the 
deployment-type. I've done this without changing too much of the previous 
behaviour (at least thats the intention). 

Instead I added some deprecation markers pointing to the new SPI, especially 
regarding the lately introduced 'environment priming logic'.

Resource names however did change, I have not reinstated the previous behavior 
here:
        server.properties -> production.properties
        server_prototype.properties -> prototyping.properties


Here's the default logic, for determing the deployment type:

        public DeploymentType getDeploymentType() {
        
                boolean anyVoteForPrototyping = false;
                
                anyVoteForPrototyping|=
                                
"true".equalsIgnoreCase(System.getenv("PROTOTYPING"));
                
                anyVoteForPrototyping|=
                                
"server_prototype".equalsIgnoreCase(System.getProperty("isis.deploymentType"));
                
                anyVoteForPrototyping|=
                                
"PROTOTYPING".equalsIgnoreCase(System.getProperty("isis.deploymentType"));
                
                final DeploymentType deploymentType =
                                anyVoteForPrototyping
                                        ? DeploymentType.PROTOTYPING
                                                        : 
DeploymentType.PRODUCTION;
                
                return deploymentType;
        }
        
The make use of the SPI, one needs to implement this interface:

        public interface IsisSystemEnvironmentPlugin {
                
                public IsisSystemEnvironment getIsisSystemEnvironment();
                
        }
        
For details see the sources and a 'reference' implementation see [1] and [2]

[1] 
https://github.com/apache/isis/blob/v2/core/commons/src/main/java/org/apache/isis/core/plugins/environment/IsisSystemEnvironmentPlugin.java
[2] 
https://github.com/apache/isis/blob/v2/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/components/IsisSystemEnvironmentPluginForTesting.java

Reply via email to