Alon Bar-Lev has posted comments on this change.

Change subject: 9. [WIP] core: Introducing configuration loader
......................................................................


Patch Set 16:

(5 comments)

http://gerrit.ovirt.org/#/c/24365/16/backend/manager/modules/extension-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ConfigurationLoader.java
File 
backend/manager/modules/extension-manager/src/main/java/org/ovirt/engine/core/extensions/mgr/ConfigurationLoader.java:

Line 29:     private static final String NAME = "ovirt.engine.extension.name";
Line 30:     private static final String SERVICE = 
"ovirt.engine.extension.service";
Line 31:     private static final String ENABLED = 
"ovirt.engine.extension.enabled";
Line 32:     private static final String MODULE = 
"ovirt.engine.extension.module";
Line 33:     private static final String TYPE = "ovirt.engine.extension.type";
> type holds the class name of the extension.
so why do oyu need the service?

as far as I know there should be 3 parameters:

1. module

2. service/class within module

3. name of instance

nothing more....
Line 34: 
Line 35:     public class ExtensionEntry {
Line 36:         private File file;
Line 37:         private boolean enabled;


Line 65:                     loadedModules.put(moduleSpec, module);
Line 66:                     ServiceLoader<? extends Extension> serviceLoader =
Line 67:                             ServiceLoader.load(Extension.class, 
module.getClassLoader());
Line 68:                     for (Extension extension : serviceLoader) {
Line 69:                         
extensionsByType.put(extension.getClass().getName(), extension.getClass());
> The motivation behind this is as follows -
we talked about this, please simplify, use the ServiceRegistry with filter 
based on service name which is the Class.getName()
Line 70:                     }
Line 71:                 } catch (ModuleLoadException exception) {
Line 72:                     throw new 
ConfigurationException(String.format("The module '%1$s' cannot be loaded.", 
moduleSpec),
Line 73:                             exception);


Line 70:                     }
Line 71:                 } catch (ModuleLoadException exception) {
Line 72:                     throw new 
ConfigurationException(String.format("The module '%1$s' cannot be loaded.", 
moduleSpec),
Line 73:                             exception);
Line 74:                 }
no reason to catch/rethrow exceptions such as this in middle of scope, you can 
have one catch for the entire function.
Line 75:             }
Line 76:             try {
Line 77:                 Class<? extends Extension> extensionClass = 
extensionsByType.get(config.getString(TYPE));
Line 78:                 if (extensionClass == null) {


Line 81:                             config.getString(TYPE)));
Line 82:                 }
Line 83:                 this.extension = extensionClass.newInstance();
Line 84:                 this.extension.setName(name);
Line 85:                 
this.extension.setConfigurationProperties(config.getProperties());
why do you need this here?
Line 86: 
Line 87:             } catch (InstantiationException | IllegalAccessException | 
IllegalArgumentException e) {
Line 88:                 throw new ConfigurationException(String.format("Error 
in instantitating extension based on tye type '%1$'",
Line 89:                         config.getString(TYPE)));


Line 85:                 
this.extension.setConfigurationProperties(config.getProperties());
Line 86: 
Line 87:             } catch (InstantiationException | IllegalAccessException | 
IllegalArgumentException e) {
Line 88:                 throw new ConfigurationException(String.format("Error 
in instantitating extension based on tye type '%1$'",
Line 89:                         config.getString(TYPE)));
same here.
Line 90:             }
Line 91:         }
Line 92: 
Line 93:         public String getName() {


-- 
To view, visit http://gerrit.ovirt.org/24365
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I182904177ec088e62b35bde870ec79725fabc4e4
Gerrit-PatchSet: 16
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Martin PeÅ™ina <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to