1 19 20 25 26 package xalanDoc; 27 28 import java.io.File ; 29 30 import com.lutris.appserver.server.*; 31 import com.lutris.appserver.server.httpPresentation.*; 32 import com.lutris.appserver.server.session.*; 33 import com.lutris.util.*; 34 35 import com.lutris.logging.Logger; 36 41 public class XalanDoc extends StandardApplication { 42 43 protected static Config config = null; 44 45 protected static String contactsDir=""; 46 protected String DEFAULT_DIRECTORY = "contacts"; 47 48 52 public void startup(Config appConfig) throws ApplicationException { 53 super.startup(appConfig); 54 55 if (logChannel != null) { 56 logChannel.write(Logger.INFO, 57 "Welcome to the XalanDoc application!"); 58 } 59 60 config = appConfig; 63 64 File tempFile = null; 65 String tempString = null; 66 67 69 try{ 70 contactsDir = XalanDoc.config.getString("XalanDoc.Contacts.Directory"); 71 tempFile = new File (contactsDir+File.separator+"contact-table.xsl"); 72 73 if (!tempFile.exists()){ 74 tempString = XalanDoc.config.getConfigFile().getFile().getParent(); 76 contactsDir = tempString+File.separator+contactsDir; 77 tempFile = new File (contactsDir+File.separator+"contact-table.xsl"); 78 79 if (!tempFile.exists()){ 80 try{ 81 tempString = this.getClass().getClassLoader().getResource(DEFAULT_DIRECTORY).getPath(); 82 contactsDir = tempString; 83 tempFile = new File (contactsDir+File.separator+"contact-table.xsl"); 84 } catch (NullPointerException exc){ 85 contactsDir = DEFAULT_DIRECTORY; 86 if (logChannel != null) { 87 logChannel.write(Logger.INFO, 88 "XalanDoc.Contacts.Directory application parameter isn't properly initialized!"); 89 } 90 } 91 } 92 } 93 } catch (ConfigException e) { 94 try{ 95 tempString = this.getClass().getClassLoader().getResource(DEFAULT_DIRECTORY).getPath(); 96 contactsDir = tempString; 97 tempFile = new File (contactsDir+File.separator+"contact-table.xsl"); 98 } catch (NullPointerException exc){ 99 contactsDir = DEFAULT_DIRECTORY; 100 if (logChannel != null) { 101 logChannel.write(Logger.INFO, 102 "XalanDoc.Contacts.Directory application parameter isn't properly initialized!"); 103 } 104 } 105 } 106 } 107 public boolean requestPreprocessor(HttpPresentationComms comms) 108 throws Exception { 109 return super.requestPreprocessor(comms); 110 } 111 112 120 public String toHtml() { 121 return "This is <I>xalanDoc</I>"; 122 } 123 124 public static String getContactsDir() { 125 return contactsDir; 126 } 127 } 128 129 | Popular Tags |