rlevas commented on a change in pull request #59: KNOX-1789 - Refactor 
RemoteAliasService to use service loading
URL: https://github.com/apache/knox/pull/59#discussion_r260000342
 
 

 ##########
 File path: 
gateway-server/src/main/java/org/apache/knox/gateway/services/DefaultGatewayServices.java
 ##########
 @@ -48,50 +49,40 @@
 import java.util.Map;
 
 public class DefaultGatewayServices implements GatewayServices {
-
   private static GatewayMessages log = MessagesFactory.get( 
GatewayMessages.class );
 
   private Map<String,Service> services = new HashMap<>();
-  private DefaultMasterService ms;
-  private DefaultKeystoreService ks;
-
-  public DefaultGatewayServices() {
-    super();
-  }
 
   @Override
   public void init(GatewayConfig config, Map<String,String> options) throws 
ServiceLifecycleException {
-    ms = new DefaultMasterService();
+    DefaultMasterService ms = new DefaultMasterService();
     ms.init(config, options);
     services.put(MASTER_SERVICE, ms);
 
-    ks = new DefaultKeystoreService();
+    DefaultKeystoreService ks = new DefaultKeystoreService();
     ks.setMasterService(ms);
     ks.init(config, options);
     services.put(KEYSTORE_SERVICE, ks);
 
-    /* create an instance so that it can be passed to other services */
-    final RemoteAliasService alias = new RemoteAliasService();
+    final DefaultAliasService defaultAlias = new DefaultAliasService();
+    defaultAlias.setKeystoreService(ks);
+    defaultAlias.setMasterService(ms);
+    defaultAlias.init(config, options);
 
     final RemoteConfigurationRegistryClientService registryClientService =
         RemoteConfigurationRegistryClientServiceFactory.newInstance(config);
-    registryClientService.setAliasService(alias);
+    registryClientService.setAliasService(defaultAlias);
 
 Review comment:
   Maybe add the doc suggested above in the code so it is not changed in the 
future by someone that does not fully understand the issue.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to