1 53 54 106 107 package com.Yasna.forum; 108 109 import com.Yasna.forum.util.ClientIP; 110 111 import java.lang.reflect.*; 112 import java.util.*; 113 114 141 public abstract class ForumFactory { 142 143 private static Object initLock = new Object (); 144 private static String className = "com.Yasna.forum.database.DbForumFactory"; 145 private static ForumFactory factory = null; 146 147 155 public static ForumFactory getInstance(Authorization authorization) { 156 if (authorization == null) { 158 return null; 159 } 160 if (factory == null) { 161 synchronized(initLock) { 162 if (factory == null) { 163 String classNameProp = PropertyManager.getProperty("ForumFactory.className"); 164 if (classNameProp != null) { 165 className = classNameProp; 166 } 167 try { 168 Class c = Class.forName(className); 170 factory = (ForumFactory)c.newInstance(); 171 } 172 catch (Exception e) { 173 System.err.println("Failed to load ForumFactory class " 174 + className + ". Yazd cannot function normally."); 175 e.printStackTrace(); 176 return null; 177 } 178 } 179 } 180 } 181 182 ForumFactoryProxy proxy = new ForumFactoryProxy( 186 factory, 187 authorization, 188 factory.getPermissions(authorization) 189 ); 190 return proxy; 191 } 192 193 204 public abstract Forum createForum(String name, String description, 205 boolean moderated, int forumGroupID, boolean article) 206 throws UnauthorizedException, ForumAlreadyExistsException; 207 208 216 public abstract Forum getForum(int forumID) 217 throws ForumNotFoundException, UnauthorizedException; 218 219 227 public abstract Forum getForum(String name) 228 throws ForumNotFoundException, UnauthorizedException; 229 230 237 public abstract int getForumCount(); 238 239 244 public abstract Iterator categories(); 245 246 254 public abstract Category getCategory(int categoryID) 255 throws CategoryNotFoundException, UnauthorizedException; 256 257 265 public abstract Category getCategory(String name) 266 throws CategoryNotFoundException, UnauthorizedException; 267 268 276 public abstract Category createCategory(String name, String description) 277 throws UnauthorizedException, CategoryAlreadyExistsException; 278 279 297 public abstract Iterator forums(); 298 299 304 public abstract Iterator forumsWithArticlesForums(); 305 306 310 311 public abstract Iterator forumsModeration(); 312 313 314 324 public abstract void deleteForum(Forum forum) 325 throws UnauthorizedException; 326 327 334 public abstract void deleteCategory(Category category) 335 throws UnauthorizedException; 336 337 340 public abstract ProfileManager getProfileManager(); 341 342 349 public abstract SearchIndexer getSearchIndexer() 350 throws UnauthorizedException; 351 352 358 public abstract int [] usersWithPermission(int permissionType) 359 throws UnauthorizedException; 360 361 367 public abstract int[] groupsWithPermission(int permissionType) 368 throws UnauthorizedException; 369 370 377 public abstract ForumPermissions getPermissions(Authorization authorization); 378 379 388 public abstract boolean hasPermission(int type); 389 394 public abstract Query createQuery(); 395 396 401 public abstract void BlackListIP(ClientIP cip,boolean add) throws UnauthorizedException; 402 403 408 public abstract boolean isBlackListed(ClientIP cip); 409 410 415 public abstract ForumThread getArticleThread(String pageKey,Forum forum) throws ForumThreadNotFoundException, UnauthorizedException; 416 417 public abstract Iterator getThreadTypeIterator(); 418 419 public abstract ThreadType getThreadType(int typeid); 420 421 public abstract Iterator getSessionList(); 422 423 public abstract int getYesterdayUserCount(); 424 425 426 427 } 428 | Popular Tags |