KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > bean > Resources


1 package org.nextime.ion.backoffice.bean;
2
3 import java.io.File JavaDoc;
4 import java.io.FileInputStream JavaDoc;
5 import java.util.Vector JavaDoc;
6 import javax.servlet.http.HttpServlet JavaDoc;
7
8 public class Resources {
9
10     private static ResourceXmlBean bean;
11     
12     public static ResourceXmlBean getResourceXmlBean(HttpServlet JavaDoc servlet, String JavaDoc id) throws Exception JavaDoc {
13         if( bean == null ) {
14             FileInputStream JavaDoc fis = new FileInputStream JavaDoc( new File(servlet.getServletContext().getRealPath("../../../conf/resources.xml")) );
15             bean = ResourceXmlBean.parse(fis);
16             fis.close();
17         }
18         return ResourceXmlBean.getResource(id);
19     }
20     
21     public static Vector JavaDoc getResourceXmlBeans(HttpServlet JavaDoc servlet) throws Exception JavaDoc {
22         if( bean == null ) {
23             FileInputStream JavaDoc fis = new FileInputStream JavaDoc( new File(servlet.getServletContext().getRealPath("../../../conf/resources.xml")) );
24             bean = ResourceXmlBean.parse(fis);
25             fis.close();
26         }
27         return ResourceXmlBean.getItems();
28     }
29
30 }
31
32
Popular Tags