[Mondrian] XMLaServlet

Jean-Francois Croteau jfcroteau at 8d.com
Thu Feb 9 08:52:04 EST 2012

Thank you for those information. But I still don't get something. I'm not using a web.xml, I'm using a Jetty embedded server. And with version 3.2.1, I could easily do that kind of code:

DataSources dataSources = new DataSourcesConfig.DataSources();
DataSourcesConfig.DataSource[] dataSourcesArray = new DataSourcesConfig.DataSource[1];
dataSources.dataSources = dataSourcesArray;

DataSourcesConfig.DataSource ds = new DataSourcesConfig.DataSource();
dataSourcesArray[0] = ds;

ds.name = "Provider=Mondrian;DataSource=" + cubeDefinition.getCubeName() + ";";
ds.description = cubeDefinition.getCubeDescription();
ds.url = mondrianExternalURL;
ds.dataSourceInfo = "Provider=Mondrian; Jdbc=jdbc:mysql://" + dbConfig.getConnectionInfo().getHostName() + ":" + dbConfig.getConnectionInfo().getPort() + "/"
		+ dbConfig.getConnectionInfo().getDatabase() + "?user=" + dbConfig.getConnectionInfo().getUsername() + "&password=" + dbConfig.getConnectionInfo().getPassword()
		+ "; JdbcDrivers=com.mysql.jdbc.Driver";
ds.providerName = "Mondrian";
// The two following configs are currently ignored by mondrian since it only supports those values by default.
ds.providerType = DataSourcesConfig.DataSource.PROVIDER_TYPE_MDP;
ds.authenticationMode = DataSourcesConfig.DataSource.AUTH_MODE_UNAUTHENTICATED;

ds.catalogs = new Catalogs();
Catalog[] catalogsArray = new Catalog[1];
ds.catalogs.catalogs = catalogsArray;

Catalog catalog = new DataSourcesConfig.Catalog();
catalogsArray[0] = catalog;
catalog.name = cubeDefinition.getCubeName();
catalog.definition = FtkDirectories.getConfig().getAbsolutePath() + File.separator + cubeDefinition.getCubeName() + ".xml";

addToDataSources( dataSources );

I don't know where to hook that kind of code in the new API 3.3.0... I'm looking at DefaultXmlaServlet(which was used before with 3.2.1), at MondrianXmlaServlet (which has no connection to a datasource), and can't find the right place to connect my code. Any idea?

Thank you.

Jean-Francois Croteau
jfcroteau at 8D.com

On 2012-02-08, at 3:30 PM, Patrick Leckey wrote:

> Hi Jean,
> In 3.3.0 this actually got much easier to accomplish because an extended XMLA servlet to do exactly this is included by default.  We use it in house and it works beautifully.  It is the DynamicDatasourceXmlaServlet, documented here:
> http://mondrian.pentaho.com/api/mondrian/xmla/impl/DynamicDatasourceXmlaServlet.html
> In your Mondrian WEB-INF/web.xml, simply override the servlet definition for the MondrianXmlaServlet to look like this:
>   <servlet>
>     <servlet-name>MondrianXmlaServlet</servlet-name>
>     <servlet-class>mondrian.xmla.impl.DynamicDatasourceXmlaServlet</servlet-class>
>     <init-param>
>       <param-name>DataSourcesConfig</param-name>
>       <param-value>http://localhost/mars/olap/datasources?provider=mondrian</param-value>
>     </init-param>
>   </servlet>
> The DataSourcesConfig value then points to whatever URL you want to have spit out your datasources XML, which Mondrian loads from there.  In the mondrian.properties file you then set the timeout (in ms) on which Mondrian will re-read that datasources URL:
> mondrian.xmla.SchemaRefreshInterval=60000
> HTH,
> Pat
> On 2012-02-08, at 3:06 PM, Jean-Francois Croteau wrote:
>> Hi everyone,
>> 	I was using Mondrian 3.2.1 to be able to programmatically define a datasource, by extending the DefaultXmlaServlet, and by using the mondrian.xmla.XmlaServlet.addToDataSources(DataSources) function to pass my programmatically defined datasources. I just updated to Mondrian 3.3.0 (because of the issue http://jira.pentaho.com/browse/MONDRIAN-675), and it seems that everything changed in the API.
>> Can someone point me what to do to be able to do the same thing? I was looking at DefaultXmlaServlet, and MondrianXmlaServlet, but I can't figure out how to replicate my work without a datasource.xml file, which I cannot do.
>> Thank you.
>> Jean-Francois Croteau
>> jfcroteau at 8D.com
>> _______________________________________________
>> Mondrian mailing list
>> Mondrian at pentaho.org
>> http://lists.pentaho.org/mailman/listinfo/mondrian
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20120209/8e20d9f6/attachment-0001.html 

More information about the Mondrian mailing list