/** * Returns the configuration that should be used to initialize this factory. * * @return the configuration for initializing the factory. */ protected Configuration getConfiguration() { return ClassicEngineBoot.getInstance().getGlobalConfig(); }
public static void performPentahoReportingBoot( LogChannelInterface log, Class<?> referenceClass ) { // Boot the Pentaho reporting engine! // if ( ClassicEngineBoot.getInstance().isBootDone() == false ) { ObjectUtilities.setClassLoader( referenceClass.getClassLoader() ); ObjectUtilities.setClassLoaderSource( ObjectUtilities.CLASS_CONTEXT ); LibLoaderBoot.getInstance().start(); LibFontBoot.getInstance().start(); ClassicEngineBoot.getInstance().start(); Exception exception = ClassicEngineBoot.getInstance().getBootFailureReason(); if ( exception != null ) { log.logError( "Error booting the Pentaho reporting engine", exception ); } } }
public static boolean isEnforceCompatibilityFor( final int level, final int prptVersionMajorRaw, final int prptVersionMinorRaw, final int prptVersionPatchRaw ) { if ( level == -1 ) { return false; } return level <= computeVersionId( prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw ); } }
if ( ClassicEngineBoot.getInstance().isBootDone() == false ) { ClassicEngineBoot.getInstance().start();
public static void main( String[] args ) throws IOException { ClassicEngineBoot.getInstance().start(); ExpressionQueryTool eqt = new ExpressionQueryTool(); eqt.processDirectory( null ); for ( int i = 0; i < eqt.expressions.size(); i++ ) { System.out.println( eqt.expressions.get( i ) ); } } }
public InMemoryDataCache() { this( ClassicEngineBoot.getInstance().getExtendedConfig().getIntProperty( "org.pentaho.reporting.engine.classic.core.cache.InMemoryCache.MaxEntries" ), ClassicEngineBoot.getInstance() .getExtendedConfig().getIntProperty( "org.pentaho.reporting.engine.classic.core.cache.InMemoryCache.CachableRowLimit" ) ); }
public void testDefaultValueExists() { ClassicEngineBoot.getInstance().getEditableConfig().setConfigProperty( key, null ); final String value = ClassicEngineBoot.getInstance().getGlobalConfig().getConfigProperty( key ); assertNotNull( value ); }
public static VersionValidity isValidVersion( final int prptVersionMajorRaw, final int prptVersionMinorRaw, final int prptVersionPatchRaw ) { return getInstance().isValidVersion( prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw, ClassicEngineInfo.getInstance() ); }
public boolean initialize( final SwingGuiContext context ) { if ( super.initialize( context ) == false ) { return false; } if ( ClassicEngineBoot.getInstance().isModuleAvailable( ExcelExportGUIModule.class.getName() ) == false ) { return false; } return true; }
public void testAll() throws Exception { final ArrayList states = new ArrayList(); final Module[] mods = ClassicEngineBoot.getInstance().getPackageManager().getAllModules(); int swingPreviewPos = 0; int fileConfigPos = 0; for ( int i = 0; i < mods.length; i++ ) { states.add( new PackageState( mods[i] ) ); } PackageSorter.sort( states ); for ( int i = 0; i < states.size(); i++ ) { final PackageState state = (PackageState) states.get( i ); if ( state.getModule().getClass().equals( SwingPreviewModule.class ) ) { logger.debug( "SwingPreviewModule: " + i ); swingPreviewPos = i; } if ( state.getModule().getClass().equals( FileConfigStoreModule.class ) ) { logger.debug( "File: " + i ); fileConfigPos = i; } } assertTrue( fileConfigPos < swingPreviewPos ); }
protected void runAllGoldReports() throws Exception { if ( "true".equals( ClassicEngineBoot.getInstance().getGlobalConfig().getConfigProperty( ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY ) ) ) { Assert.fail( "Dont run GoldenSample tests with the new layout system. These tests are not platform independent." ); } final int numThreads = Math.max( 1, ClassicEngineBoot.getInstance().getExtendedConfig().getIntProperty( "org.pentaho.reporting.engine.classic.core.testsupport.gold.MaxWorkerThreads", Math.max( 1, Runtime.getRuntime().availableProcessors() - 1 ) ) ); StopWatch w = new StopWatch(); w.start(); try { if ( numThreads == 1 ) { runAllGoldReportsSerial(); } else { runAllGoldReportsInParallel( numThreads ); } } finally { System.out.println( w.toString() ); } }
@PerfTest( duration = PerfBenchmarkingTest.MAX_DURATION, threads = PerfBenchmarkingTest.MAX_THREADS, rampUp = PerfBenchmarkingTest.MAX_RAMPUP, warmUp = PerfBenchmarkingTest.MAX_WARMUP ) @Test public void perfClassicBootStart() { if ( !isExecutePerformanceTest ) { return; } // Mock up isBootDone to return true to ensure we reload libs every time ClassicEngineBoot mock = mock( ClassicEngineBoot.class ); when( mock.isBootDone() ).thenReturn( true ); mock.start(); } }
/** * Performs the actual boot process. */ protected void performBoot() { if ( ClassicEngineBoot.isStrictFP() == false ) { ClassicEngineBoot.logger.warn( "The used VM seems to use a non-strict floating point arithmetics" ); // NON-NLS ClassicEngineBoot.logger.warn( "Layouts computed with this Java Virtual Maschine may be invalid." ); // NON-NLS ClassicEngineBoot.logger.warn( "JFreeReport and the library 'iText' depend on the strict floating point rules" ); // NON-NLS ClassicEngineBoot.logger.warn( "of Java1.1 as implemented by the Sun Virtual Maschines." ); // NON-NLS ClassicEngineBoot.logger.warn( "If you are using the BEA JRockit VM, start the Java VM with the option" ); // NON-NLS ClassicEngineBoot.logger.warn( "'-Xstrictfp' to restore the default behaviour." ); // NON-NLS } final PackageManager mgr = getPackageManager(); mgr.addModule( ClassicEngineCoreModule.class.getName() ); mgr.load( "org.pentaho.reporting.engine.classic.core.modules." ); // NON-NLS mgr.load( "org.pentaho.reporting.engine.classic.extensions.modules." ); // NON-NLS mgr.load( "org.pentaho.reporting.engine.classic.extensions.datasources." ); // NON-NLS mgr.load( "org.pentaho.reporting.engine.classic.core.userdefined.modules." ); // NON-NLS bootAdditionalModules(); mgr.initializeModules(); if ( mgr.isModuleAvailable( ClassicEngineCoreModule.class.getName() ) == false ) { throw new IllegalStateException( "Booting the report-engine failed." ); } StyleKey.lock(); }
/** * Boots modules, which have been spcified in the "org.pentaho.reporting.engine.classic.core.boot.Modules" * configuration parameter. */ private void bootAdditionalModules() { try { final String bootModules = getGlobalConfig().getConfigProperty( "org.pentaho.reporting.engine.classic.core.boot.Modules" ); // NON-NLS if ( bootModules != null ) { final CSVTokenizer csvToken = new CSVTokenizer( bootModules, "," ); while ( csvToken.hasMoreTokens() ) { final String token = csvToken.nextToken(); getPackageManager().load( token ); } } } catch ( SecurityException se ) { // we'll ignore any Security exception .. ClassicEngineBoot.logger.info( "Security settings forbid to check the system properties for extension modules." ); // NON-NLS } catch ( Exception se ) { ClassicEngineBoot.logger.error( "An error occured while checking the system properties for extension modules.", // NON-NLS se ); } }
/** * A helper method that checks, whether a given module is available. The result of this method is undefined if the * system has no been booted yet. * * @param moduleClass * the class-name of the module that should be tested. * @return true, if the module is available and has been initialized correctly, false otherwise. */ public boolean isModuleAvailable( final String moduleClass ) { return getPackageManager().isModuleAvailable( new DefaultModuleInfo( moduleClass, null, null, null ) ); }
private void validateVersionNumbers( final int prptVersionMajorRaw, final int prptVersionMinorRaw, final int prptVersionPatchRaw ) throws ParseException { final ClassicEngineBoot.VersionValidity v = ClassicEngineBoot.isValidVersion( prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw ); if ( v == ClassicEngineBoot.VersionValidity.INVALID_RELEASE ) { throw new ParseException( String.format( "The report file you are trying to load was created with " + "Pentaho Reporting %d.%d but you are trying to run it with Pentaho Reporting %s. " + "Please update your reporting installation to match the report designer that was used " + "to create this file.", prptVersionMajorRaw, prptVersionMinorRaw, ClassicEngineInfo.getInstance() .getVersion() ) ); } else if ( v == ClassicEngineBoot.VersionValidity.INVALID_PATCH ) { logger.warn( String.format( "The report file you are trying to load was created with Pentaho " + "Reporting %d.%d.%d but you are trying to run it with Pentaho Reporting %s. " + "Your reporting engine version may not have all features or bug-fixes required to display " + "this report properly.", prptVersionMajorRaw, prptVersionMinorRaw, prptVersionPatchRaw, ClassicEngineInfo .getInstance().getVersion() ) ); } }
public static void main( final String[] args ) { ClassicEngineBoot.getInstance().start(); final ExpressionMetaData[] datas = ExpressionRegistry.getInstance().getAllExpressionMetaDatas(); Arrays.sort( datas, GroupedMetaDataComparator.ENGLISH ); for ( int i = 0; i < datas.length; i++ ) { final ExpressionMetaData data = datas[i]; if ( data instanceof AbstractMetaData == false ) { continue; } printMetaBundle( data ); } }
public EhCacheDataCache() { this( ClassicEngineBoot.getInstance().getExtendedConfig().getIntProperty( "org.pentaho.reporting.engine.classic.core.cache.EhCacheDataCache.CachableRowLimit" ) ); }
public void testLocalReportConfigAccessible() { ClassicEngineBoot.getInstance().getEditableConfig().setConfigProperty( key, null ); final String value = ClassicEngineBoot.getInstance().getGlobalConfig().getConfigProperty( key ); ClassicEngineBoot.getInstance().getEditableConfig().setConfigProperty( key, value + "-repconf" ); final String value3 = ClassicEngineBoot.getInstance().getGlobalConfig().getConfigProperty( key ); assertNotNull( value3 ); assertEquals( value + "-repconf", value3 ); }
public void testTrunkIsValid() { // Set current version to 3.3.3 final ProjectInformation projectInfo = Mockito.mock( ProjectInformation.class ); Mockito.when( projectInfo.getReleaseMajor() ).thenReturn( "999" ); Mockito.when( projectInfo.getReleaseMinor() ).thenReturn( "999" ); Mockito.when( projectInfo.getReleaseMilestone() ).thenReturn( "999" ); final int[] trunk = parseVersionId( ClassicEngineBoot.VERSION_TRUNK ); Assert.assertEquals( "TRUNK version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( trunk[0], trunk[1], trunk[2], projectInfo ) ); Assert.assertEquals( "The same version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( 3, 3, 3, projectInfo ) ); Assert.assertEquals( "Older version must be valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot .getInstance().isValidVersion( 2, 2, 2, projectInfo ) ); Assert.assertEquals( "Newer major version must be release valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot.getInstance().isValidVersion( 4, 3, 3, projectInfo ) ); Assert.assertEquals( "Newer minor version must be release valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot.getInstance().isValidVersion( 3, 4, 3, projectInfo ) ); Assert.assertEquals( "Newer patch version must be patch valid", ClassicEngineBoot.VersionValidity.VALID, ClassicEngineBoot.getInstance().isValidVersion( 3, 3, 4, projectInfo ) ); }