• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResourceManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.reporting.libraries.resourceloader.ResourceManager的典型用法代码示例。如果您正苦于以下问题:Java ResourceManager类的具体用法?Java ResourceManager怎么用?Java ResourceManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResourceManager类属于org.pentaho.reporting.libraries.resourceloader包,在下文中一共展示了ResourceManager类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testSaveAndLoad

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public void testSaveAndLoad() throws Exception
{
  MasterReport report = new MasterReport();
  report.getReportHeader().addElement(createElement());

  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  BundleWriter.writeReportToZipStream(report, bout);

  ResourceManager mgr = new ResourceManager();
  MasterReport loadedReport = (MasterReport) mgr.createDirectly(bout.toByteArray(), MasterReport.class).getResource();
  assertEquals(1, loadedReport.getReportHeader().getElementCount());

  Element element = loadedReport.getReportHeader().getElement(0);
  assertTrue(element.getElementType() instanceof SampleTextElementType);
  assertEquals("Test message for validation: {0}",
      element.getAttribute(SampleElementModule.NAMESPACE, SampleTextElementType.TEMPLATE_STRING));

  runAndValidateReport(loadedReport);
}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:20,代码来源:SampleTextElementTest.java


示例2: doPost

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Getting the report.
    ResourceManager manager = new ResourceManager();
    manager.registerDefaults();
    Resource res = manager.createDirectly(
      new URL("file:resources/interactive_report_2.prpt"),
      MasterReport.class);
    MasterReport report = (MasterReport) res.getResource();

    // Mandatory parameter.
    report.getParameterValues().put("LINE", request.getParameter("line"));

    // Conversion to HTML and rendering.
    response.setContentType("text/html");
    HtmlReportUtil.createStreamHTML(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:31,代码来源:PentahoServlet2.java


示例3: testPrptSetMasterReport

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
@Test
public void testPrptSetMasterReport() throws Exception{

  if(ClassicEngineBoot.getInstance().isBootDone() == false){
    ClassicEngineBoot engineBoot = ClassicEngineBoot.getInstance();
    engineBoot.start();
  }
  
  SwtXulLoader loader = new SwtXulLoader();
  loader.register("PRPT", PrptViewerTag.class.getCanonicalName());
  XulDomContainer container = loader.loadXul("org/pentaho/agilebi/test/res/prpt.xul");
  
  PrptViewerTag prpt = (PrptViewerTag) container.getDocumentRoot().getElementById("prptViewer");
  
  ResourceManager theResourceManager = new ResourceManager();
  theResourceManager.registerDefaults();
  File theReportFile = new File("test-res/test.prpt");
  Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
  MasterReport masterReport = (MasterReport) theResource.getResource();
  
  prpt.setMasterReport(masterReport);
  
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:24,代码来源:TestPrptComponent.java


示例4: testSaveAndLoad

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public void testSaveAndLoad() throws Exception
{
  MasterReport report = new MasterReport();
  report.getReportHeader().addElement(createElement());

  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  BundleWriter.writeReportToZipStream(report, bout);

  ResourceManager mgr = new ResourceManager();
  MasterReport loadedReport = (MasterReport) mgr.createDirectly(bout.toByteArray(), MasterReport.class).getResource();
  assertEquals(1, loadedReport.getReportHeader().getElementCount());

  Element element = loadedReport.getReportHeader().getElement(0);
  assertTrue(element.getElementType() instanceof SampleGraphicsElementType);
  assertEquals("Test message for validation: {0}",
      element.getAttribute(SampleElementModule.NAMESPACE, SampleGraphicsElementType.TEMPLATE_STRING));
  assertEquals(0.5f,element.getStyle().getStyleProperty(SampleElementStyleKeys.IMAGE_BACKGROUND_ALPHA));

  runAndValidateReport(loadedReport);
}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:21,代码来源:SampleGraphicsElementTest.java


示例5: doPost

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException 
{

  try {

    // Getting the report.
    ResourceManager manager = new ResourceManager();
    manager.registerDefaults();
    Resource res = manager.createDirectly(
      new URL("file:resources/interactive_report_1.prpt"),
      MasterReport.class);
    MasterReport report = (MasterReport) res.getResource(); 

    // Conversion to HTML and rendering.
    response.setContentType("text/html");
    HtmlReportUtil.createStreamHTML(report, response.getOutputStream());

  }
  catch (Exception e) 
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:28,代码来源:PentahoServlet.java


示例6: doPost

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
@Override
public void doPost(
  HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException, IOException
{

  // Prpt file.
  String reportPath = "file:" + this.getServletContext().getRealPath("WEB-INF/classes/reports/my_first_report.prpt");

  try 
  {

    // Resource manager.
    ResourceManager manager = new ResourceManager();
    manager.registerDefaults();

    // Get report.
    Resource res = manager.createDirectly(new URL(reportPath), MasterReport.class);
    MasterReport report = (MasterReport) res.getResource();

    // Generate report in PDF into the response.
    response.setContentType("application/pdf");
    PdfReportUtil.createPDF(report, response.getOutputStream());

  }
  catch (Exception e)
  {
      e.printStackTrace();
  }
}
 
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:32,代码来源:PentahoServlet2.java


示例7: loadMasterReport

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public static MasterReport loadMasterReport(String sourceFilename) throws Exception {
  ResourceManager manager = new ResourceManager();  
     manager.registerDefaults();  
     FileObject fileObject = KettleVFS.getFileObject(sourceFilename);
     URL url = new URL(fileObject.getName().getURI());
     Resource resource = manager.createDirectly(url, MasterReport.class);
     MasterReport report = (MasterReport) resource.getResource();
     
     return report;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:PentahoReportingOutput.java


示例8: loadMasterReport

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public static MasterReport loadMasterReport( String sourceFilename ) throws Exception {
  ResourceManager manager = new ResourceManager();
  manager.registerDefaults();
  FileObject fileObject = KettleVFS.getFileObject( sourceFilename );
  URL url = new URL( fileObject.getName().getURI() );
  Resource resource = manager.createDirectly( url, MasterReport.class );
  MasterReport report = (MasterReport) resource.getResource();

  return report;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:11,代码来源:PentahoReportingOutput.java


示例9: getReferencedResources

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public ResourceReference[] getReferencedResources(final DataFactoryMetaData dataFactoryMetaData,
                                                  final DataFactory dataFactory,
                                                  final ResourceManager resourceManager,
                                                  final String query,
                                                  final DataRow dataRow)
{
  return new ResourceReference[0];
}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:9,代码来源:SampleDataFactoryCore.java


示例10: open

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public boolean open(Node transNode, String fname, boolean importfile) {
  try {
    
    if(ClassicEngineBoot.getInstance().isBootDone() == false){

      ObjectUtilities.setClassLoader(getClass().getClassLoader());
      ObjectUtilities.setClassLoaderSource(ObjectUtilities.CLASS_CONTEXT);
      
      LibLoaderBoot.getInstance().start();
      LibFontBoot.getInstance().start();
      ClassicEngineBoot.getInstance().start();
    }      
    
    ResourceManager theResourceManager = new ResourceManager();
    theResourceManager.registerDefaults();
    File theReportFile = new File(fname);
    Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
    MasterReport masterReport = (MasterReport) theResource.getResource();
    
    
    XulTabAndPanel tabAndPanel = AgileBiVisualizationPerspective.getInstance().createTab();
    AgileBiVisualizationPerspective.getInstance().setNameForTab(tabAndPanel.tab, getPathAndFilename(fname)[1].replace(".prpt", "")); //$NON-NLS-1$ //$NON-NLS-2$

    SpoonPerspectiveManager.getInstance().activatePerspective(AgileBiVisualizationPerspective.class);
    SwtXulLoader theXulLoader = new SwtXulLoader();
    theXulLoader.registerClassLoader(getClass().getClassLoader());
    theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag"); //$NON-NLS-1$ //$NON-NLS-2$
    XulDomContainer theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/visualizations/prpt/prptVisualization.xul", new PDIMessages(IVisualization.class)); //$NON-NLS-1$
    
    PRPTMeta meta = new PRPTMeta();
    meta.setTab(tabAndPanel.tab);
    AgileBiVisualizationPerspective.getInstance().setMetaForTab(tabAndPanel.tab, meta);
    
    PRPTVisualizationController controller = new PRPTVisualizationController(meta, masterReport);
    controller.setFileName(fname);
    controller.setDirty(false);
    PmdDataFactory theDataFactory = (PmdDataFactory) masterReport.getDataFactory();
    String theXmiFile = theDataFactory.getXmiFile();
    
    ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
    XmiParser parser = new XmiParser();
    FileInputStream inputStream = new FileInputStream(new File(theXmiFile));
    Domain domain = parser.parseXmi(inputStream);
    inputStream.close();

    LogicalModel logical = domain.getLogicalModels().get(0);
    Object property = logical.getProperty("source_type"); //$NON-NLS-1$
    if( property != null ) {
      IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
      theSource.initialize(domain);   
      model.setModelSource(theSource);
    }

    model.setDomain(domain);
    model.setModelName(domain.getId());
    model.setFileName(theXmiFile); 
    model.setTemporary(false);
    controller.setModel(model);
    theXulContainer.addEventHandler(controller);
    
    Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainContainer").getManagedObject(); //$NON-NLS-1$
    SwtXulRunner theRunner = new SwtXulRunner();
    theRunner.addContainer(theXulContainer);
    theRunner.initialize();
    theMainBox.setParent((Composite) tabAndPanel.panel.getManagedObject());

    ((Composite) tabAndPanel.panel.getManagedObject()).layout(true);

    AgileBiVisualizationPerspective.getInstance().setSelectedMeta(meta);
    return true;
  } catch(Exception e){
    e.printStackTrace();
  }
  return false;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:76,代码来源:PRPTVisualization.java


示例11: main

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
public static void main(String[] args)
{
  try
  {
    // Initialize the reporting engine. The reporting engine wont work without it.
    // You have to do that only once before you first use any functionality or class
    // of the reporting engine. If you don't, errors will happen.
    ClassicEngineBoot.getInstance().start();

    // Locate the report file
    final URL url = UseReportingGui.class.getResource("sdk-sample-report.prpt");
    // and use a resource-manager to load it. Pentaho Reporting loads all
    // its resources via the resource-manager. This manager will cache resources
    // for you and will invalidate the cache when the resources changed on disk.
    final ResourceManager mgr = new ResourceManager();

    // The master-report object is the actual report definition.
    final MasterReport report = (MasterReport) mgr.createDirectly(url, MasterReport.class).getResource();

    // Bring up the preview-dialog. We have to do this on the AWT-event-dispatcher thread
    // or all sorts of strange errors can happen.
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        final PreviewDialog d = new PreviewDialog(report);
        d.pack();
        d.setModal(true);

        LibSwingUtil.centerFrameOnScreen(d);

        d.setVisible(true);
        System.exit(0);
      }
    });
  }
  catch (ResourceException e)
  {
    System.err.println("Failed to load the report");
    e.printStackTrace(System.err);
  }

}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:44,代码来源:UseReportingGui.java


示例12: processReport

import org.pentaho.reporting.libraries.resourceloader.ResourceManager; //导入依赖的package包/类
private static void processReport(String sourceText, String targetText)
        throws ResourceException, IOException, BundleWriterException, ContentIOException {

  File sourceFile = new File(sourceText);
  MasterReport report = (MasterReport) new ResourceManager().createDirectly(sourceFile, MasterReport.class).getResource();

  MasterReport processedReport = manipulateReport(report);

  BundleWriter.writeReportToZipFile(report, new File(targetText));
}
 
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:11,代码来源:PatchAReportSample.java



注:本文中的org.pentaho.reporting.libraries.resourceloader.ResourceManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Pipe类代码示例发布时间:2022-05-23
下一篇:
Java XIncludeNamespaceSupport类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap