CommandFactory.createCommand() method

This method searches the command registry(CMDREG table) for an entry corresponding to the specified command name (Interface)and storeId. if no entry is found for specified store, it will look for an entry corresponding to storeId=0. if both fail, it will check for a default implementation of the command from the interface and returns an entry that represent the default implementation of the interface.

Ex:

static final String defaultCommandClassName = "com.ibm.commerce.sample.commands.MyNewControllerCmdImpl";

so, when you make a command with the CommandFactory class, you need to pass in the interface name, rather than the implementation class, since the field looked up in the database is the CMDREG.INTERFACE field.

if you specify the implementation class (MyNewControllerCmdImpl) rather than the interface (MyNewControllerCmd) may result in a ClassNotFoundException.

Comments

Anonymous said…
In an extended sites model, is it preferred to define the commands using storeId=0 or repeat the definitions for each storeId that uses the command ? In theory, there can exist stores on the platform that might no use a shared command. Thoughts?
Anonymous said…
Can i request you plz elaborate it.

Popular posts from this blog

Dataload Utility In WCS

WebSphere Commerce

10 Steps to Configure Email – Websphere Commerce Server