PDA

View Full Version : CWM classes dependent on Kettle dependent on SWT?



pvmurthy
01-03-2007, 05:36 AM
Hi,

I was going through the pentaho-metadata app -- and liked everything i saw. Great effort! and hope to see a lot of activity in this.

Now for my question -- I am planning to use the CWM xmi file generated for writing my own adhoc reporting solution.

To help parse the CWM file, i started using the same flow as in the pentaho-metadata project. But am stuck at a point where -- the cwm classes seem to depend on the Kettle - Props to be initialized which seems to require the swt widgets - Display class.

Since I plan to use the whole library inside a web-app -- i would not like to include SWT classes.

Any reason why this dependency exists? can it be circumvented in some way?

EnvUtil.environmentInit();
Const.checkPentahoMetadataDirectory();
CWM cwm = CWM.getInstance(cwmName);
cwm.importFromXMI(cwmRsrc.getInputStream());

The model seems to be loaded correctly. When I try to get access to the SchemaMeta instance -- I get an error that the Kettle system has not been initialized
CwmSchemaFactoryInterface cwmSchemaFactory = Settings.getCwmSchemaFactory();
SchemaMeta schemaMeta = cwmSchemaFactory.getSchemaMeta(cwmHolder.getCWM("ClassicModels"));


But -- When I try to do Props.init -- it seems to require an SWT Display instance...

Any pointers on how to get around this?

Cheers
Murthy

pvmurthy
01-03-2007, 05:44 AM
Solved! --

I should not have used the Settings class -- to get the SchemaFactory

CwmSchemaFactoryInterface cwmSchemaFactory = new CwmSchemaFactory();

SchemaMeta schemaMeta = cwmSchemaFactory.getSchemaMeta(cwmHolder.getCWM("ClassicModels"));

This worked.

Thanks to Matt's sample eclipse project :)

Cheers
Murthy

MattCasters
01-03-2007, 07:06 AM
I was just about to answer the same. I'm glad you found the sample snippet useful.
If there's other stuff you need, just post.

Seems that after the holidays, the PMD project is picking up speed and this pleases me a lot.

Matt

elassad
04-18-2007, 06:10 AM
just out of curiosity i just found the the pentaho meta data project and since I'm trying to do ad-hoc reports too i was wondering
what does CWM stand for and how can it be usefull for building a report the only place i could found where the CWM is involved is this one:

MQLQuery mql = new MQLQuery(mqlNode.asXML(), LocaleHelper.getLocale().toString(), cwmSchemaFactory);


any clarification will be much appreciated!

greetings
yel

MattCasters
04-18-2007, 11:07 AM
CWM : Common Warehouse Metamodel.

See also: http://www.omg.org/cwm

We indeed did build another layer on top of the CWM because it is somewhat ... euh.. unwieldy.
Se we solved all the complexity for you guys and you can just use SchemaMeta to work with.
You can use CwmSchemaFactory to convert between CWM and SchemaMeta

All the best,

Matt