BbServiceManager是很常用的一个工具类
# ContextManager
Blackboard有一套自己的上下文管理机制,通过ContextManager可以做很多事情
BbServiceManager.getContextManager().getContext();
# 实例信息
例如可以获取数据库信息,Blackboard可以运行在Oracle、SQLServer之上
VirtualInstallation virtualInstallation = BbServiceManager.getContextManager().getContext().getVirtualInstallation();
virtualInstallation.getDataType();
virtualInstallation.getDbHost();
virtualInstallation.getDbPort();
virtualInstallation.getDbInstanceType();
virtualInstallation.getDbInstance();
virtualInstallation.getDbUser();
virtualInstallation.getDbPass();
# 当前状态信息
例如可以获取当前客户端的操作用户,这个用户所在课程,课程中的注册信息,浏览的课程资源等
Context context = BbServiceManager.getContextManager().getContext();
context.getSession();
context.getUser();
context.getCourse();
context.getCourseMembership();
context.getContent();
# 客户端的国际化语言
Context context = BbServiceManager.getContextManager().getContext();
context.getLocale();
# ConfigurationService
获取Blackboard的配置信息
# 文件存储物理地址
物理文件不要放在自己的web目录下,要放到持久化的content中,不然下次部署时,之前的东西就都木有了
ConfigurationService config = BbServiceManager.getConfigurationService();
File bbContentDir = config.getSharedContentDir();