1、CallbackUtil
回调工具类org.enhydra.shark.CallbackUtil定义在Shark.class中,也可以通过配置文件修改为用户指定的类。在配置文件中是这样描述的:CallbackUtilitiesClassName=org.enhydra.shark.CallbackUtil
CallbackUtil类位于modules/SharkKernel/Standard/src目录下,它实现了CallbackUtilities接口。CallbackUtilities位于modules/SharkAPI/src目录下 org.enhydra.shark.api.internal.working包中。
2、调用方式
通过参数注入的方式,对CallbackUtil进行调用:
...
private CallbackUtilities callback;
public void configure (CallbackUtilities cus) throws RootException {
if (null == cus)
throw new RootException("Cannot configure without call back impl.");
callback = cus;
HibernateUtilities.init(callback.getProperties());
callback.debug("HibernateUserGroupManager configured");
}
...
3、实现的接口
CallbackUtilities接口定义了如下一些方法:
/** 设置、读取Shark 配置文件中的内容**/
String getProperty (String propertyName);
String getProperty (String propertyName,String defaultValue);
Properties getProperties ();
void setProperties (Properties props);
/** 以下方法提供Log功能 **/
void error (String msg);
void error (String msg,RootException ex);
void error (String channel,String msg);
void error (String channel,String msg,RootException ex);
void warn (String msg);
void warn (String msg,RootException ex);
void warn (String channel,String msg);
void warn (String channel,String msg,RootException ex);
void info (String msg);
void info (String msg,RootException ex);
void info (String channel,String msg);
void info (String channel,String msg,RootException ex);
void debug (String msg);
void debug (String msg,RootException ex);
void debug (String channel,String msg);
void debug (String channel,String msg,RootException ex);
Trackback: http://tb.donews.net/TrackBack.aspx?PostId=852115