1 13 package com.tonbeller.jpivot.xmla; 14 15 import java.io.IOException ; 16 import java.net.URL ; 17 18 import org.apache.log4j.Logger; 19 import org.xml.sax.SAXException ; 20 21 import com.tonbeller.jpivot.core.Model; 22 import com.tonbeller.jpivot.core.ModelFactory; 23 import com.tonbeller.jpivot.olap.model.OlapException; 24 import com.tonbeller.jpivot.olap.model.OlapModel; 25 import com.tonbeller.jpivot.tags.OlapModelTag; 26 import com.tonbeller.wcf.controller.RequestContext; 27 28 31 public class XMLA_OlapModelTag extends OlapModelTag { 32 private static Logger logger = Logger.getLogger(XMLA_OlapModelTag.class); 33 34 private String config = null; 35 private String uri = null; private String catalog = null; private String dataSource = null; 39 protected OlapModel getOlapModel(RequestContext context) throws SAXException , IOException , OlapException { 40 41 URL url; 42 if (config == null) 43 url = getClass().getResource("config.xml"); 44 else 45 url = pageContext.getServletContext().getResource(config); 46 47 Model model = ModelFactory.instance(url); 51 52 if (!(model instanceof XMLA_Model)) 53 throw new OlapException("invalid class attribute for model tag, resource=" + config); 54 55 XMLA_Model xm = (XMLA_Model) model; 56 xm.setUri(uri); 57 xm.setDataSource(dataSource); 58 xm.setCatalog(catalog); 59 xm.setMdxQuery(getBodyContent().getString()); 60 61 return xm; 62 } 63 64 68 public String getConfig() { 69 return config; 70 } 71 72 76 public void setConfig(String config) { 77 this.config = config; 78 } 79 80 84 public String getCatalog() { 85 return catalog; 86 } 87 88 92 public String getDataSource() { 93 return dataSource; 94 } 95 96 100 public String getUri() { 101 return uri; 102 } 103 104 108 public void setCatalog(String catalog) { 109 this.catalog = catalog; 110 } 111 112 116 public void setDataSource(String dataSource) { 117 this.dataSource = dataSource; 118 } 119 120 124 public void setUri(String uri) { 125 this.uri = uri; 126 } 127 128 } | Popular Tags |