#916 Hard-coded CMSEngine class name.
Closed: fixed 4 years ago by edewata. Opened 10 years ago by edewata.

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.


Per CS/DS Meeting on 3/24/2014 - confirmed with edewata.

Metadata Update from @edewata:
- Issue set to the milestone: UNTRIAGED

7 years ago

Metadata Update from @edewata:
- Custom field feature adjusted to None
- Custom field proposedmilestone adjusted to None
- Custom field proposedpriority adjusted to None
- Custom field reviewer adjusted to None
- Custom field version adjusted to None
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

4 years ago

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/1483

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Login to comment on this ticket.

Metadata