You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the CMSEngine class name is hard-coded in the CMS.start(). This is inappropriate because CMS is a common class used by client and server, and CMSEngine is a class that is only available on the server, so CMS.start() method will never work on the client.
public final class CMS {
public static void start(String path) throws EBaseException {
String classname = "com.netscape.cmscore.apps.CMSEngine";
try {
ICMSEngine engine = (ICMSEngine)
Class.forName(classname).newInstance();
CMS.setCMSEngine(engine);
IConfigStore mainConfig = createFileConfigStore(path);
CMS.init(null, mainConfig);
CMS.startup();
} catch (...) {
...
}
}
}
One possible solution is to remove CMS.start() and let the caller calls the above code directly. This way the caller has a full control how the engine is created. For example:
public class CMSStartServlet ... {
public static void init() ... {
CMSEngine engine = new CMSEngine();
CMS.setCMSEngine(engine);
try {
IConfigStore mainConfig = createFileConfigStore(path);
engine.init(null, mainConfig);
engine.startup();
} catch (...) {
...
engine.shutdown();
}
}
}
This way it's possible to use a different engine implementation, for example a mockup engine instance for unit tests.
The text was updated successfully, but these errors were encountered:
This issue was migrated from Pagure Issue #916. Originally filed by edewata (@edewata) on 2014-03-18 03:20:53:
Currently the CMSEngine class name is hard-coded in the CMS.start(). This is inappropriate because CMS is a common class used by client and server, and CMSEngine is a class that is only available on the server, so CMS.start() method will never work on the client.
One possible solution is to remove CMS.start() and let the caller calls the above code directly. This way the caller has a full control how the engine is created. For example:
This way it's possible to use a different engine implementation, for example a mockup engine instance for unit tests.
The text was updated successfully, but these errors were encountered: