ForumFactory

王朝java/jsp·作者佚名  2006-01-09
宽屏版  字体: |||超大  

public static ForumFactory getInstance(Authorization authorization)---返回某种形式的 ForumFactory的Proxy。为什么要用Proxy呢,因为在这个工厂方法中,有createForum等方法,显然,这些东东需要权限的认证。通过参数authorization可以很容易的返回使用者的权限。

ForumFactoryProxy proxy = new ForumFactoryProxy(

factory,

authorization,

factory.getPermissions(authorization)

);

public abstract Forum createForum(String name, String description)--创建一个论坛

throws UnauthorizedException, ForumAlreadyExistsException;

public abstract Forum getForum(String name)--通过名称返回一个论坛

throws ForumNotFoundException, UnauthorizedException;

public abstract int getForumCount();--返回论坛个数

public abstract Iterator forums();--返回所有可读的论坛

public abstract Iterator forumsModeration();--返回所有 Moderation, Forum Admin or System Admin的权限的论坛

public abstract void deleteForum(Forum forum)---删除forum

throws UnauthorizedException;

public abstract ProfileManager getProfileManager();--返回一个可以管理用户和组的ProfileManager

public abstract SearchIndexer getSearchIndexer()--也是返回一个管理Index的SearchIndexer

throws UnauthorizedException;

public abstract int [] usersWithPermission(int permissionType)--返回具有某个权限的所有用户

throws UnauthorizedException;

public abstract int[] groupsWithPermission(int permissionType)--返回具有某个权限的所有组

throws UnauthorizedException;

public abstract ForumPermissions getPermissions(Authorization authorization);--返回某个用户的所具有的权限

public abstract boolean hasPermission(int type);--是否具有某方面的权限

综上可以看出,一个ForumFactory其实就是在全局上管理了Forum,同时它也做了一些“外事”,比如说getProfileManager()等,其实,它所做的事情是相对于整个Forum的,而不是对于“某个”Forum,所以,其并没有createThread()之类的东东,至于这些东东应该是在Forum中来完成,毕竟,对于某个Forum来说,对于那些Thread,Message它又是“全局”的了,所以,全局是相对的哦。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有