1 26 27 package org.nextime.ion.frontoffice.bean; 28 29 import java.io.File ; 30 import java.io.FileInputStream ; 31 import java.util.Vector ; 32 import javax.servlet.http.HttpServlet ; 33 34 import org.nextime.ion.frontoffice.servlet.SectionServlet; 35 36 public class SectionTypes { 37 38 private static TypeBean bean; 39 40 public static TypeBean getSectionBean(HttpServlet servlet, String template) throws Exception { 41 if( bean == null ) { 42 FileInputStream fis = new FileInputStream ( new File (servlet.getServletContext().getRealPath(SectionServlet.relativePath)) ); 43 bean = TypeBean.parse(fis); 44 fis.close(); 45 } 46 return bean.getBean(template); 47 } 48 49 public static Vector getSectionsBeans(HttpServlet servlet) throws Exception { 50 if( bean == null ) { 51 FileInputStream fis = new FileInputStream ( new File (servlet.getServletContext().getRealPath(SectionServlet.relativePath)) ); 52 bean = TypeBean.parse(fis); 53 fis.close(); 54 } 55 return bean.getItems(); 56 } 57 58 } 59 60 | Popular Tags |