Ganesh Kumar
Posts: 2
Nickname: ganesh2000
Registered: Jun, 2006
BIRT Report Problem
Posted: Jun 1, 2006 12:16 AM
Advertisement
import java.io.IOException; import org.eclipse.birt.report.designer.core.DesignerConstants; import org.eclipse.birt.report.model.api.DesignElementHandle; import org.eclipse.birt.report.model.api.DesignEngine; import org.eclipse.birt.report.model.api.ElementFactory; import org.eclipse.birt.report.model.api.OdaDataSourceHandle; import org.eclipse.birt.report.model.api.ReportDesignHandle; import org.eclipse.birt.report.model.api.SessionHandle; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.data.oda.flatfile.FlatFileDriver; /** * Simple BIRT Design Engine API (DEAPI) demo. */ public class odaRpt { public static void main(String[] args) { try { buildReport(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SemanticException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // This function shows how to build a very simple BIRT report with a // minimal set of content: a simple grid with an image and a label. static void buildReport() throws IOException, SemanticException { SessionHandle session = DesignEngine.newSession(null); ReportDesignHandle design = session.createDesign("Hello"); ElementFactory factory = design.getElementFactory(); DesignElementHandle element = factory .newSimpleMasterPage("Page Master"); //$NON-NLS-1$ design.getMasterPages().add(element); ElementFactory elementFactory = design.getElementFactory(); OdaDataSourceHandle dataSourceHandle = elementFactory.newOdaDataSource("DataSource",DesignerConstants.DATA_SOURCE_FLAT FILE); dataSourceHandle.setProperty("HOME", "E:\\TEMP"); dataSourceHandle.setProperty("CHARSET", "UTF-8"); dataSourceHandle.setProperty("INCLTYPELINE", "YES"); design.saveAs("sample_3.rptdesign"); design.close(); } private static OdaDataSourceHandle createFlatFileDataSource(ReportDesignHandle reportDesignHandle, ElementFactory elementFactory) throws SemanticException { OdaDataSourceHandle dataSourceHandle = elementFactory.newOdaDataSource("Data Source", DesignerConstants.DATA_SOURCE_FLATFILE); dataSourceHandle.setProperty("HOME", "E:\\TEMP"); dataSourceHandle.setProperty("CHARSET", "UTF-8"); dataSourceHandle.setProperty("INCLTYPELINE", "YES"); reportDesignHandle.getDataSources().add(dataSourceHandle); return dataSourceHandle; } } -------------------------------------- The Above Code Generating Following Error ---------------------------------------- java.lang.IllegalArgumentExcepti on: The extension with ID 'org.eclipse.birt.report.data.oda.flatfile' is not found! at org.eclipse.birt.report.model.extension.oda.ODAManifestUtil.getDataSourceExtens ion(ODAManifestUtil.java:54) at org.eclipse.birt.report.model.api.ElementFactory.newOdaDataSource(ElementFactor y.java:757) at odaRpt.buildReport(odaRpt.java:46) at odaRpt.main(odaRpt.java:22) Exception in thread "main"