[teiid-commits] teiid SVN: r2876 - in trunk: build/kits/jboss-container/teiid-examples/jca and 2 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jan 25 16:13:35 EST 2011


Author: rareddy
Date: 2011-01-25 16:13:35 -0500 (Tue, 25 Jan 2011)
New Revision: 2876

Added:
   trunk/build/kits/jboss-container/teiid-examples/jca/olap-xmla-ds.xml
Modified:
   trunk/build/kits/jboss-container/teiid-examples/jca/mondrian-ds.xml
   trunk/build/kits/jboss-container/teiid-releasenotes.html
   trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java
   trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
Log:
TEIID-1011: adding documentation for using the translator

Modified: trunk/build/kits/jboss-container/teiid-examples/jca/mondrian-ds.xml
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/jca/mondrian-ds.xml	2011-01-25 20:19:07 UTC (rev 2875)
+++ trunk/build/kits/jboss-container/teiid-examples/jca/mondrian-ds.xml	2011-01-25 21:13:35 UTC (rev 2876)
@@ -1,9 +1,28 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <datasources>
+
+    <!--
+        Provide these jars in JBoss AS profile's "lib" directory, to place the mondrian JDBC driver
+        on classpath.
+        
+        commons-math-1.0.jar
+        commons-vfs-1.0.jar
+        eigenbase-properties.jar
+        eigenbase-resgen.jar
+        eigenbase-xom.jar
+        javacup.jar
+        mondrian.jar
+        olap4j.jar
+        
+        Only use this datasource, if your mondrian server is also deployed to same JBoss AS
+        server, this will make embedded connection to mondrian. If you are working remote 
+        then use olap-xmla-ds.xml file  
+    -->
+
   <local-tx-datasource>
     <jndi-name>mondrianDS</jndi-name>
     <!-- note here that you need to also create datasource for source, this is for mondrian as source for teiid -->
-    <connection-url>jdbc:mondrian:Provider=Mondrian;DataSource=java:foodmart;Catalog=${jboss.server.home.dir}/deploy/mondrian.war/WEB-INF/queries/FoodMart.xml;</connection-url>
+    <connection-url>jdbc:mondrian:Provider=Mondrian;DataSource=java:foodmart;Catalog=FoodMart;Catalog=${jboss.server.home.dir}/deploy/mondrian.war/WEB-INF/queries/FoodMart.xml;</connection-url>
     <driver-class>mondrian.olap4j.MondrianOlap4jDriver</driver-class>
     <user-name>user</user-name>
     <password>password</password>

Added: trunk/build/kits/jboss-container/teiid-examples/jca/olap-xmla-ds.xml
===================================================================
--- trunk/build/kits/jboss-container/teiid-examples/jca/olap-xmla-ds.xml	                        (rev 0)
+++ trunk/build/kits/jboss-container/teiid-examples/jca/olap-xmla-ds.xml	2011-01-25 21:13:35 UTC (rev 2876)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<datasources>
+
+   <!-- olap4j.jar is required for this. Download from http://www.olap4j.org/ and place in the JBoss AS profile's "lib" directory -->
+  <no-tx-datasource>
+    <jndi-name>xmlaDS</jndi-name>
+    <!-- note here that you need to also create datasource for source, this is for mondrian as source for teiid -->
+    <connection-url>jdbc:xmla:Server=http://127.0.0.1:8080/mondrian/xmla;Provider=Mondrian;DataSource=java:foodmart;Catalog=FoodMart;</connection-url>
+    <driver-class>org.olap4j.driver.xmla.XmlaOlap4jDriver</driver-class>
+    <transaction-isolation>-1</transaction-isolation>
+    <user-name>user</user-name>
+    <password>password</password>
+     <min-pool-size>5</min-pool-size>
+     <max-pool-size>20</max-pool-size>
+  </no-tx-datasource>    
+  
+</datasources>


Property changes on: trunk/build/kits/jboss-container/teiid-examples/jca/olap-xmla-ds.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- trunk/build/kits/jboss-container/teiid-releasenotes.html	2011-01-25 20:19:07 UTC (rev 2875)
+++ trunk/build/kits/jboss-container/teiid-releasenotes.html	2011-01-25 21:13:35 UTC (rev 2876)
@@ -27,6 +27,7 @@
 <H2><A NAME="Highlights"></A>Highlights</H2>
 <UL>
 	<LI><B>Virtual procedure out params</B> - virtual procedures can now have RETURN/OUT/INOUT parameters to return values.
+	<LI><B>OLAP</B> - OLAP translator is now part of Teiid kit using OLAP4J
 </UL>
 
 <h2><a name="Compatibility">Compatibility Issues</a></h2>

Modified: trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java
===================================================================
--- trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java	2011-01-25 20:19:07 UTC (rev 2875)
+++ trunk/connectors/translator-olap/src/main/java/org/teiid/translator/olap/OlapQueryExecution.java	2011-01-25 21:13:35 UTC (rev 2876)
@@ -48,7 +48,6 @@
 import org.teiid.translator.ProcedureExecution;
 import org.teiid.translator.TranslatorException;
 
- at SuppressWarnings("nls")
 public class OlapQueryExecution implements ProcedureExecution {
 
 	protected Command command;
@@ -130,7 +129,7 @@
 			this.rows = rowAxis.iterator();
 			if (this.rows.hasNext()) {
 				this.nextRow = this.rows.next();
-				this.buffer = "<resultset>".toCharArray();
+				this.buffer = "<resultset>".toCharArray(); //$NON-NLS-1$
 			}
     	}
     	
@@ -141,7 +140,7 @@
     		
     		StringBuilder sb = new StringBuilder();
 			CellSetAxis cols = cellSet.getAxes().get(Axis.COLUMNS.axisOrdinal());
-			sb.append("<row>");
+			sb.append("<row>"); //$NON-NLS-1$
 
 			// add in rows axis
 			List<Member> members = nextRow.getMembers();
@@ -150,7 +149,7 @@
 				columnName = columnName.replace(' ', '_');
 				sb.append('<').append(columnName).append('>');
 				sb.append(member.getName());
-				sb.append("</").append(columnName).append('>');
+				sb.append("</").append(columnName).append('>'); //$NON-NLS-1$
 			}
 
 			// add col axis
@@ -160,9 +159,9 @@
 				columnName = columnName.replace(' ', '_');
 				sb.append('<').append(columnName).append('>');
 				sb.append(cell.getValue());
-				sb.append("</").append(columnName).append('>');
+				sb.append("</").append(columnName).append('>'); //$NON-NLS-1$
 			}				
-			sb.append("</row>");
+			sb.append("</row>");//$NON-NLS-1$
 			
 			// advance the cursor to next row.
 			if (this.rows.hasNext()) {
@@ -185,7 +184,7 @@
 				String next = readNextRow();
 				if (next == null) {
 					if (!this.closed) {
-						this.buffer = "</resultset>".toCharArray();
+						this.buffer = "</resultset>".toCharArray();//$NON-NLS-1$
 						this.closed = true;
 					}
 					else {

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml	2011-01-25 20:19:07 UTC (rev 2875)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml	2011-01-25 21:13:35 UTC (rev 2876)
@@ -1014,7 +1014,69 @@
                 </section>
             </section>
         </section>
+        
         <section>
+            <title>OLAP Translator</title>
+            <para>
+            The OLAP Services translator, known by the type name <emphasis>olap</emphasis>, 
+            exposes stored procedures for calling analysis sevices backed by a OLAP server using MDX query lanaguage. Given the MDX
+            query, this translator executes the query and returns the results in XML format.
+            It will commonly be used with the <link linkend="xmltable">XMLTABLE</link> table functions to use XML formated data.
+            </para>
+            <para>
+            Since the Cube metadata exposed by the OLAP servers and relational database metadata are so different, there is no single 
+            way to map the metadata from one to other. It is best that OLAP system be queried using its own native MDX language
+            through Teiid abstraction layers than introducing a custom Teiid based MDX like extensions for querying. To build MDX 
+            queries dynamically use Teiid's abstraction layer define your target schema in relational terms and use Teiid's procedural 
+            langaugage to build a query.
+            </para>
+                
+            <section>
+                <title>Usage</title>
+                <para>
+                The olap translator exposes one low level procedure for accessing olap services.  
+                </para>
+
+                <section>
+                    <title>InvokeMDX Procedure</title>
+                    <para>
+                    <methodname>invokeMdx</methodname> returns the XML contents of results in tabular form. 
+                    </para>
+                    <programlisting>Procedure invokeMdx(mdx in STRING) returns SQLXML</programlisting>
+        
+                    <para>
+                    mdx parameter indicates the query in its original form that is to be executed on the OLAP server.
+                    </para>
+                    <para>
+                    The results of the query will be returned in SQLXML form that in the format as shown below.
+                    <programlisting role="XML" language="XML"><![CDATA[
+    <?xml version="1.0" encoding="UTF-8"?>
+    <resultset>
+        <row>
+            <Promotion_Media>All Media</Promotion_Media>
+            <Product>All Products</Product>
+            <Unit_Sales>266773.0</Unit_Sales>
+            <Store_Cost>225627.2336</Store_Cost>
+            <Store_Sales>565238.13</Store_Sales>
+        </row>
+    </resultset>                    
+                    ]]></programlisting>           
+                    From the above XML result, the first two columns in the row were the members from the row axis and the 
+                    last three columns are the measures from the cube from column axis. Currently the resultset only supports
+                    2 dimentional cube.          
+                    </para>
+                    
+                    <para>
+                    This translator requires a data source to be configured to the OLAP cube using OLAP4J JDBC driver. Two sample
+                    -ds.xml files provided for accessing OLAP servers in teiid-examples section. One is Mondrian specific, when Mondrian server is deloyed
+                    in the same JBoss AS as Teiid (mondrian-ds.xml). To access any other OLAP servers using XMLA interface, 
+                    the data source for them can be created using them example template olap-xmla-ds.xml
+                    </para>
+                </section>
+            </section>
+        </section>        
+        
+        <section>
             <title>Delegating Translators</title>
             <para>
             You may create a delegating translator by extending the <code>org.teiid.translator.BaseDelegatingExecutionFactory</code>.



More information about the teiid-commits mailing list