PDA

View Full Version : Using dashboard outside pentaho



PBIUser
04-17-2006, 11:54 PM
I would like to use pentao dashboard library in my web application
I have read that i can use it outside pentaho
I have found component Org.pentaho.ui.component.WidgetGridComponent but have a problems with request, session when using it outside pentaho

I download sources and in line 185 (function getXmlContent)

// get the data to populate the widgets
IPentahoResultSet resultSet = null;

if( solution != null ) {
resultSet = getActionData();
}
else {
// TODO support other methods of getting data
}

So, do i really can use it outside pentaho?


My initialization
StandaloneApplicationContext applicationContext = new StandaloneApplicationContext("C:\\\\my path with xml files", "" );
PentahoSystem.init( applicationContext );



My generation

SimpleUrlFactory simpleUrlFactory = new SimpleUrlFactory("http://localhost:8080/MyWebApp/");

String widgetDefinition = "myxml1.xml"; //$NON-NLS-1$
String widgetGridDataDefinition = "myxml2.xml";//$NON-NLS-1$

ArrayList messages = new ArrayList();

WidgetGridComponent widget = new WidgetGridComponent( widgetDefinition, simpleUrlFactory, messages ); //$NON-NLS-1$
widget.setDataAction( widgetGridDataDefinition ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$

String content = widget.getContent( "text/html" ); //$NON-NLS-1$


Error occurs
java.lang.NullPointerException
at org.pentaho.solution.SolutionEngine.execute(SolutionEngine.java:152)
at org.pentaho.ui.component.WidgetGridComponent.getActionData(WidgetGridComponent.java:346)
at org.pentaho.ui.component.WidgetGridComponent.getXmlContent(WidgetGridComponent.java:187)
at org.pentaho.ui.component.XmlComponent.getContent(XmlComponent.java:39)

When i create session

SimpleUrlFactory simpleUrlFactory = new SimpleUrlFactory("http://localhost:8080/MyWebApp/");

String widgetDefinition = "myxml1.xml"; //$NON-NLS-1$
String widgetGridDataDefinition = "myxml2.xml";//$NON-NLS-1$

ArrayList messages = new ArrayList();

WidgetGridComponent widget = new WidgetGridComponent( widgetDefinition, simpleUrlFactory, messages ); //$NON-NLS-1$
widget.setDataAction( widgetGridDataDefinition ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$

PentahoHttpSession pentahoHttpSession = new PentahoHttpSession("fakelogin", pageContext.getSession(), null);
widget.validate( pentahoHttpSession, null );

String content = widget.getContent( "text/html" ); //$NON-NLS-1$

Error occurs in class org.pentaho.repository.runtime.RuntimeRepository in function setSession
when calling HibernateUtil.beginTransaction()


I would only like to generate dashboards - do i really need special session, repository, hiberate...