1 10 11 package freeforums.jspbeans; 12 13 import javax.naming.*; 14 import java.util.Hashtable ; 15 import javax.rmi.PortableRemoteObject ; 16 import java.util.Properties ; 17 import java.io.FileInputStream ; 18 import java.util.Properties ; 19 20 import freeforums.forum.ForumManager; 21 import freeforums.forum.ForumManagerHome; 22 import freeforums.forum.Forum; 23 import freeforums.forum.ForumHome; 24 25 import org.jdom.*; 26 27 28 public class ForumController extends Object { 29 30 33 34 public ForumController() { } 35 36 39 40 public Document getForumListingForUser(Document UserDetails) { 41 42 try { 43 ForumManagerHome home = (ForumManagerHome) new InitialContext().lookup("ForumManagerBean"); 45 ForumManager manager = home.create(); 47 return manager.findForumsForUser(UserDetails); 48 49 } 50 catch(Exception e) { 51 System.err.println("Exception occured \n" + e); 53 return (new Document(new Element("Response").addContent("Failed"))); 54 } 55 56 } 58 61 62 public Document getCompleteForumListing() { 63 64 try { 65 ForumManagerHome home = (ForumManagerHome) new InitialContext().lookup("ForumManagerBean"); 67 ForumManager manager = home.create(); 69 return manager.findAll(); 70 71 } 72 catch(Exception e) { 73 System.err.println("Exception occured \n" + e); 75 return (new Document(new Element("Response").addContent("Failed"))); 76 } 77 78 } 80 public Document addForum(Document ForumInformation) { 81 82 try { 83 ForumManagerHome home = (ForumManagerHome) new InitialContext().lookup("ForumManagerBean"); 85 ForumManager manager = home.create(); 87 return manager.addForum(ForumInformation); 88 89 } 90 catch(Exception e) { 91 System.err.println("Exception occured \n" + e); 93 return (new Document(new Element("Response").addContent("Failed"))); 94 } 95 96 } 98 public Document getForumListForUser(Document ForumInformation) { 99 100 try { 101 ForumManagerHome home = (ForumManagerHome) new InitialContext().lookup("ForumManagerBean"); 103 ForumManager manager = home.create(); 105 return manager.findForumsForUser(ForumInformation); 106 107 } 108 catch(Exception e) { 109 System.err.println("Exception occured \n" + e); 111 return (new Document(new Element("Response").addContent("Failed"))); 112 } 113 114 } 116 public Document isUserAllowed(Document ForumUserInfo) { 117 118 try { 119 ForumManagerHome home = (ForumManagerHome) new InitialContext().lookup("ForumManagerBean"); 121 ForumManager manager = home.create(); 123 return manager.isUserAllowed(ForumUserInfo); 124 125 } 126 catch(Exception e) { 127 System.err.println("Exception occured \n" + e); 129 return (new Document(new Element("Response").addContent("Failed"))); 130 } 131 132 } 134 } | Popular Tags |