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它又是“全局”的了,所以,全局是相对的哦。 
  
  
 
  |