大家尽量用commerce command factory支持的default command
implementation的功能来避免注册cmdreg,减小维护的成本。
默认寻找command实现类的方式是:在定义command接口的时候,定义一个字符串常量defaultCommandClassName
,指出该command的默认实现类是什么。
command factory根据command
interface的寻找command
implementation顺序是:先在cmdreg里面找当前store_id上注册的implementation,找不到时找store_id=0的商店上注册的implementation,再找不到就找interface里面定义的defaultCommandClassName常量指定的实现类。
public interface
ResellerOrderUploadCmd extends ControllerCommand {
/**
* IBM copyright notice field.
*/
public static final String
COPYRIGHT = com.ibm.commerce.copyright.IBMCopyright.SHORT_COPYRIGHT;
/**
* The name of this interface is
"com.lining.commerce.order.commands.ResellerOrderUploadCmd".
*/
public final static java.lang.String NAME =
ResellerOrderUploadCmd.class.getName();
/**
* The default
implementation class name is
"com.lining.commerce.order.commands.ResellerOrderUploadCmdImpl".
*/
public static String defaultCommandClassName
=
"com.lining.commerce.order.commands.ResellerOrderUploadCmdImpl
";
}
我确信ResellerOrderUploadCmd
在各个商店上都只会用ResellerOrderUploadCmdImpl
实现类(其实这个command在业务上永远都只会在代销直营商店使用),所以我就不用在cmdreg里面注册这个command了。