Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard-coded CMSEngine class name. #1483

Closed
pki-bot opened this issue Oct 2, 2020 · 3 comments
Closed

Hard-coded CMSEngine class name. #1483

pki-bot opened this issue Oct 2, 2020 · 3 comments

Comments

@pki-bot
Copy link

pki-bot commented Oct 2, 2020

This issue was migrated from Pagure Issue #916. Originally filed by edewata (@edewata) on 2014-03-18 03:20:53:

  • Closed at 2019-11-04 14:55:49 as fixed
  • Assigned to nobody

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.

@pki-bot pki-bot added this to the UNTRIAGED milestone Oct 2, 2020
@pki-bot pki-bot closed this as completed Oct 2, 2020
@pki-bot
Copy link
Author

pki-bot commented Oct 2, 2020

Comment from mharmsen (@mharmsen) at 2014-03-24 20:37:35

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

@pki-bot
Copy link
Author

pki-bot commented Oct 2, 2020

Comment from edewata (@edewata) at 2017-02-27 14:03:13

Metadata Update from @edewata:

  • Issue set to the milestone: UNTRIAGED

@pki-bot
Copy link
Author

pki-bot commented Oct 2, 2020

Comment from edewata (@edewata) at 2019-11-04 14:55:50

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant