1 21 package com.jaspersoft.jasperserver.util; 22 23 import java.io.IOException ; 24 import java.net.URL ; 25 26 import net.sf.jasperreports.engine.JRRuntimeException; 27 28 import org.exolab.castor.mapping.Mapping; 29 import org.exolab.castor.mapping.MappingException; 30 31 35 public class MappingHelper { 36 37 private static final Mapping exportImportBeanMapping; 38 39 static { 40 exportImportBeanMapping = new Mapping(); 41 URL mappingXML = MappingHelper.class.getResource("/ImportExportBean-mapping.xml"); 42 if (mappingXML == null) { 43 throw new JRRuntimeException("Could not load ImportExportBean mapping resource (ImportExportBean-mapping.xml)"); 44 } 45 try { 46 exportImportBeanMapping.loadMapping(mappingXML); 47 } catch (IOException e) { 48 throw new JRRuntimeException(e); 49 } catch (MappingException e) { 50 throw new JRRuntimeException(e); 51 } 52 } 53 54 public static Mapping getExportImportBeanMapping() { 55 return exportImportBeanMapping; 56 } 57 58 } 59 | Popular Tags |