/** * Creates a new configuration. */ public HierarchicalConfiguration() { this.configuration = new DefaultConfiguration(); }
/** * Creates a new configuration. */ public HierarchicalConfiguration() { this.configuration = new DefaultConfiguration(); }
public SettingsRootElementHandler() { this.configuration = new DefaultConfiguration(); }
public BundleSettings( final Configuration configuration ) { if ( configuration == null ) { throw new NullPointerException(); } final DefaultConfiguration defConf = new DefaultConfiguration(); final Enumeration configProperties = configuration.getConfigProperties(); while ( configProperties.hasMoreElements() ) { final String key = (String) configProperties.nextElement(); final String value = configuration.getConfigProperty( key ); if ( value != null ) { defConf.setConfigProperty( key, value ); } } this.configuration = defConf; }
/** * Creates a new root-handler using the given versioning information and resource-manager. * * @param manager the resource manager that loaded this xml-file. * @param source the source-key that identifies from where the file was loaded. * @param context the key that should be used to resolve relative paths. * @param version the versioning information for the root-file. */ public RootXmlReadHandler( final ResourceManager manager, final ResourceKey source, final ResourceKey context, final long version ) { if ( manager == null ) { throw new NullPointerException(); } if ( source == null ) { throw new NullPointerException(); } this.firstCall = true; this.manager = manager; this.source = source; this.context = context; this.dependencyCollector = new DependencyCollector( source, version ); this.objectRegistry = new HashMap<String, Object>(); this.parserConfiguration = new DefaultConfiguration(); this.commentHandler = new CommentHandler(); this.namespaces = new FastStack<String>(); }
/** * Returns a new (and not connected to the default config from the job) configuration containing all properties from * the dialog. * * @param full * @return */ protected Configuration grabDialogContents( final boolean full ) { final DefaultConfiguration p = new DefaultConfiguration(); if ( full ) { p.setProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.xls.FileName", getFilename() ); //$NON-NLS-1$ } p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.xls.StrictLayout", String .valueOf( isStrictLayout() ) ); //$NON-NLS-1$ return p; }
/** * Returns a new (and not connected to the default config from the job) configuration containing all properties from * the dialog. * * @param full * @return */ protected Configuration grabDialogContents( final boolean full ) { final DefaultConfiguration p = new DefaultConfiguration(); if ( full ) { p.setProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.xls.FileName", getFilename() ); //$NON-NLS-1$ } p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.xls.StrictLayout", String .valueOf( isStrictLayout() ) ); //$NON-NLS-1$ return p; }
/** * Returns a new (and not connected to the default config from the job) configuration containing all properties from * the dialog. * * @param full * @return */ protected Configuration grabDialogContents( final boolean full ) { final DefaultConfiguration p = new DefaultConfiguration(); if ( full ) { p.setProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.rtf.FileName", getFilename() ); //$NON-NLS-1$ } p.setProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.StrictLayout", //$NON-NLS-1$ String.valueOf( isStrictLayout() ) ); return p; }
public void load( final InputStream in ) throws IOException { if ( in == null ) { throw new NullPointerException(); } final DefaultConfiguration encodingConfig = new DefaultConfiguration(); encodingConfig.load( in ); final PropertyPrinterSpecificationLoader loader = new PropertyPrinterSpecificationLoader(); final PrinterEncoding[] encodings = loader.loadEncodings( encodingConfig ); final PrinterSpecification[] printers = loader.loadPrinters( encodingConfig, encodings ); // if there is a valid printer definition available, we do not // need a generic "Generic" printer. If one is required, it will // be defined by the specification file. if ( printers.length > 0 ) { printerModels.remove( PrinterSpecificationManager.getGenericPrinter().getName() ); } for ( int i = 0; i < printers.length; i++ ) { addPrinter( printers[i] ); } }
@Test public void testExportToRTFFile() throws Exception { String filename = "./testfile.rtf"; MasterReport report = Mockito.mock( MasterReport.class ); ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.rtf.FileName", filename ); Mockito.doReturn( conf ).when( report ).getConfiguration(); File file = new File( filename ).getCanonicalFile(); Assert.assertFalse( file.exists() ); RTFExportTask task = new RTFExportTask( report, null, null ); task.run(); Assert.assertTrue( file != null ); Assert.assertTrue( file.exists() ); file.delete(); } }
@Test public void testCreateParentFolder() { String filename = getTestDirectory() + "/" + "testfile.html"; MasterReport report = Mockito.mock( MasterReport.class ); ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.paged.CreateParentFolder", "true" ); Mockito.doReturn(conf).when(report).getConfiguration(); File file = null; File directory; try { file = new File( filename ).getCanonicalFile(); directory = file.getParentFile(); if ( directory != null ) { if ( directory.exists() == true ) { directory.delete(); } } Assert.assertFalse( directory.exists() ); HtmlReportUtil.createDirectoryHTML( report, filename ); } catch (Exception e1) { e1.printStackTrace(); } directory = file.getParentFile(); Assert.assertTrue( directory != null ); Assert.assertTrue( directory.exists() ); file.delete(); directory.delete(); } }
/** * Returns a new (and not connected to the default config from the job) configuration containing all properties from * the dialog. * * @param full * @return */ protected Configuration grabDialogContents( final boolean full ) { final ModifiableConfiguration config = new DefaultConfiguration(); config.setConfigProperty( CSVProcessor.CSV_SEPARATOR, getSeparatorString() ); config.setConfigProperty( CSVProcessor.CSV_DATAROWNAME, String.valueOf( isColumnNamesAsFirstRow() ) ); config.setConfigProperty( CSVProcessor.CSV_ENCODING, getEncoding() ); config.setConfigProperty( CSVProcessor.CSV_ENABLE_GROUPFOOTERS, String.valueOf( isEnableGroupFooter() ) ); config.setConfigProperty( CSVProcessor.CSV_ENABLE_GROUPHEADERS, String.valueOf( isEnableGroupHeader() ) ); config.setConfigProperty( CSVProcessor.CSV_ENABLE_ITEMBANDS, String.valueOf( isEnableItembands() ) ); config.setConfigProperty( CSVProcessor.CSV_ENABLE_REPORTFOOTER, String.valueOf( isEnableReportFooter() ) ); config.setConfigProperty( CSVProcessor.CSV_ENABLE_REPORTHEADER, String.valueOf( isEnableReportHeader() ) ); config.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.csv.FileName", getFilename() ); //$NON-NLS-1$ config.setConfigProperty( CSVProcessor.CSV_WRITE_STATECOLUMNS, "false" ); //$NON-NLS-1$ return config; }
@Test public void testCreateParentFolder() { String filename = getTestDirectory() + "/" + "testfile.rtf"; MasterReport report = Mockito.mock( MasterReport.class ); ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.rtf.FileName", filename ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.rtf.CreateParentFolder", "true" ); Mockito.doReturn(conf).when(report).getConfiguration(); File file = null; File directory; try { file = new File( filename ).getCanonicalFile(); directory = file.getParentFile(); if ( directory != null ) { if ( directory.exists() == true ) { directory.delete(); } } Assert.assertFalse( directory.exists() ); RTFExportTask task = new RTFExportTask( report, null, null ); task.run(); } catch (Exception e1) { e1.printStackTrace(); } directory = file.getParentFile(); Assert.assertTrue( directory != null ); Assert.assertTrue( directory.exists() ); file.delete(); directory.delete(); }
ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.xls.FileName", filename ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.xls.CreateParentFolder", "true" );
ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.xls.FileName", filename ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.xls.CreateParentFolder", "true" );
ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.stream.TargetFileName", filename ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.stream.CreateParentFolder", "true" );
ModifiableConfiguration conf = Mockito.spy( new DefaultConfiguration() ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.csv.FileName", filename ); conf.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.csv.CreateParentFolder", "true" );
/** * Returns a new (and not connected to the default config from the job) configuration containing all properties from * the dialog. * * @param full * @return */ protected Configuration grabDialogContents( final boolean full ) { final ModifiableConfiguration config = new DefaultConfiguration(); config.setConfigProperty( CSVProcessor.CSV_SEPARATOR, getSeparatorString() ); config.setConfigProperty( CSVTableModule.SEPARATOR, getSeparatorString() ); config.setConfigProperty( CSVTableModule.STRICT_LAYOUT + ".StrictLayout", //$NON-NLS-1$ String.valueOf( isStrictLayout() ) ); config.setConfigProperty( CSVTableModule.ENCODING, getEncoding() ); config.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.csv.FileName", getFilename() ); //$NON-NLS-1$ config.setConfigProperty( CSVProcessor.CSV_WRITE_STATECOLUMNS, "false" ); //$NON-NLS-1$ return config; }
/** * Returns a new (and not connected to the default config from the job) configuration containing all properties from * the dialog. * * @param full * @return */ protected Configuration grabDialogContents( final boolean full ) { final DefaultConfiguration p = new DefaultConfiguration(); if ( full ) { p.setProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.stream.TargetFileName", //$NON-NLS-1$ getFilename() ); } p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.html.Keywords", //$NON-NLS-1$ getKeywords() ); p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.html.Description", //$NON-NLS-1$ getDescription() ); p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.html.Author", //$NON-NLS-1$ getAuthor() ); p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.html.Encoding", //$NON-NLS-1$ getEncoding() ); p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.html.Title", //$NON-NLS-1$ getHTMLTitle() ); p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.table.html.StrictLayout", //$NON-NLS-1$ String.valueOf( isStrictLayout() ) ); return p; }
final DefaultConfiguration p = new DefaultConfiguration(); if ( full ) { p.setConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.html.file.DataDirectory", //$NON-NLS-1$