> On March 2, 2016, 6:04 a.m., John Blum wrote:
> > geode-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncherCacheProvider.java,
> >  line 32
> > <https://reviews.apache.org/r/44242/diff/1/?file=1275906#file1275906line32>
> >
> >     Probably, we can simplify this interface to...
> >     
> >     Cache createCache(ServerLauncher serverLauncher);
> >     
> >     Since getProperties() as well as 
> > getDistributedSystemProperties(:Properties) methods are both public, along 
> > with other public methods, we can access everything we need from the 
> > ServerLauncher API itself.

getDistributedSystemProperties(:Properties) is actually not public. Do you 
think we should make it public? Or maybe use it in 
getDistributedSystemProperties() with no arguments, and make that public? It's 
not really clear to me why we have a getProperties and 
getDistributedSystemProperties and what the value of 
getDistributedSystemProperties is.


> On March 2, 2016, 6:04 a.m., John Blum wrote:
> > geode-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java,
> >  line 720
> > <https://reviews.apache.org/r/44242/diff/1/?file=1275905#file1275905line720>
> >
> >     The assignment to the ServerLauncher.cache instance variable should be 
> > done here, outside of the createCache(:Properties) method.
> >     
> >     This both simplifies (unit) testing as well as subclassing, especially 
> > since the createCache(..) method is part of the ServerLauncher API.

Fixed


> On March 2, 2016, 6:04 a.m., John Blum wrote:
> > geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java,
> >  line 36
> > <https://reviews.apache.org/r/44242/diff/1/?file=1275908#file1275908line36>
> >
> >     Remove unecessary default constructor, especially since it only 
> > contains a TODO and no actual initialization logic.

done


> On March 2, 2016, 6:04 a.m., John Blum wrote:
> > geode-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java,
> >  line 791
> > <https://reviews.apache.org/r/44242/diff/1/?file=1275905#file1275905line791>
> >
> >     Ideally, the cache creation logic of this method should be consistent, 
> > i.e. always by way of Service Provider.
> >     
> >     In that case, even Geode could provide a "default" implementation based 
> > on the logic in "startWithGemFireApi(:Properties") rather than the 
> > createCache(:Properties) method delegating to this method directly.  So, 
> > replace the startWithGemFireApi(:Properties) with a, for example, 
> > GeodeApiServerLauncherCacheProvider.
> >     
> >     However, you would need additional logic to determine provider 
> > precedence, which could be based (partially) on which options the user 
> > selected in Gfsh when calling 'start server' (e.g. gfsh>start server 
> > --name=Example --spring-xml-location=..., thus use the 
> > SpringDataGemFireServerLauncherCacheProvider, or gfsh>start server 
> > --name=AnotherExample --cache-xml-file=..., so use the 
> > GeodeApiServerLauncherCacheProvider).

I've refactored the code so that the startWithGemFirePAI is now also in a 
Service Provider.

However, I'm not sure how to enforce the precendence other than by just making 
sure the default provider gets invoked after we've tried all of the plugged in 
providers. See what you think and let me know if there is something more you'd 
like to see here.


- Dan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/44242/#review121586
-----------------------------------------------------------


On March 2, 2016, 10:09 p.m., Dan Smith wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/44242/
> -----------------------------------------------------------
> 
> (Updated March 2, 2016, 10:09 p.m.)
> 
> 
> Review request for geode, Jason Huynh, Jens Deppe, and John Blum.
> 
> 
> Repository: geode
> 
> 
> Description
> -------
> 
> Removing the direct use of Spring Data Gemfire from within the geode
> code. Replacing it with a SPI that allows the user to override the
> behavior of ServerLauncher.start with their own implementation that
> creates a cache.
> 
> Spring Data Gemfire can provide an implementation that bootstraps the
> cache using spring, if spring-xml-location is specified.
> 
> Users should implement ServerLauncherCacheProvider. The cache will be
> created by the first provider that returns a non null cache. If no
> providers create a cache, the cache will be created by the
> ServerLauncher itself.
> 
> It would be nice to move the spring-xml-location parameter itself into
> the interface, but this is hard to do because gfsh determines the
> parameters to start-server by looking at the arguments in the command
> class. So I left spring-xml-location alone.
> 
> Removing the spring data jar from the compile time dependencies. I've
> moved it to the geode-assembly project, so it is still shipped for the
> moment.
> 
> 
> Diffs
> -----
> 
>   geode-assembly/build.gradle 5930f13c5307e0cd70396b019263176a377d415a 
>   geode-core/build.gradle 041dc07c860c008f117d37969ee688375c2a348d 
>   
> geode-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncher.java 
> c991cc147d975a9bfd44d0c3720f80bc3e35f7ab 
>   
> geode-core/src/main/java/com/gemstone/gemfire/distributed/ServerLauncherCacheProvider.java
>  PRE-CREATION 
>   
> geode-core/src/main/java/com/gemstone/gemfire/distributed/internal/DefaultServerLauncherCacheProvider.java
>  PRE-CREATION 
>   
> geode-core/src/test/java/com/gemstone/gemfire/distributed/LauncherTestSuite.java
>  73a23374b82f998780ae8c757d869446dcfaca71 
>   
> geode-core/src/test/java/com/gemstone/gemfire/distributed/MockServerLauncherCacheProvider.java
>  PRE-CREATION 
>   
> geode-core/src/test/java/com/gemstone/gemfire/distributed/ServerLauncherWithSpringJUnitTest.java
>  bf82af8268f0b35c6ed15b26783ef37c9c329c10 
>   
> geode-core/src/test/resources/META-INF/services/com.gemstone.gemfire.distributed.ServerLauncherCacheProvider
>  PRE-CREATION 
>   geode-core/src/test/resources/spring/spring-gemfire-context.xml 
> a728493be7ee2a960dc3c9e5e8c449686d6b09cd 
>   gradle/rat.gradle abda0345d89635a41feed4dd4d68d7cb5e1d6d93 
> 
> Diff: https://reviews.apache.org/r/44242/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Dan Smith
> 
>

Reply via email to