public GuavaCachePoolPentahoJcrSessionFactory( Repository repository, String workspace, PentahoTransactionManager transactionManager ) { super( repository, workspace ); this.transactionManager = transactionManager; ISystemConfig systemConfig = PentahoSystem.get( ISystemConfig.class ); if ( systemConfig != null && systemConfig.getConfiguration( "repository" ) != null ) { try { this.cacheDuration = Integer.parseInt( systemConfig.getConfiguration( "repository" ).getProperties().getProperty( "cache-ttl", "300" ) ); this.cacheSize = Integer.parseInt( systemConfig.getConfiguration( "repository" ).getProperties().getProperty( "cache-size", "100" ) ); } catch ( IOException e ) { logger.info( "Could not find repository.cache-duration" ); } } }
private void initSkipUserVerification( final Properties prop ) { skipUserVerification = SKIP_USER_VERIFICATION_DEFAULT_VALUE; // default behaviour if ( prop != null && prop.containsKey( SKIP_USER_VERIFICATION_PROP_KEY ) && !prop.getProperty( SKIP_USER_VERIFICATION_PROP_KEY ).isEmpty() ) { // reading property from the class initialization properties is useful for unit testing skipUserVerification = Boolean.valueOf( prop.getProperty( SKIP_USER_VERIFICATION_PROP_KEY, String.valueOf( SKIP_USER_VERIFICATION_DEFAULT_VALUE ) ) ); } else if ( systemConfig != null ) { try { // reading property from security.properties ( standard behaviour ) IConfiguration config = this.systemConfig.getConfiguration( "security" ); // security.properties if ( config != null && config.getProperties().containsKey( SKIP_USER_VERIFICATION_PROP_KEY ) && !config.getProperties().getProperty( SKIP_USER_VERIFICATION_PROP_KEY ).isEmpty() ) { skipUserVerification = Boolean.valueOf( config.getProperties().getProperty( SKIP_USER_VERIFICATION_PROP_KEY, String.valueOf( SKIP_USER_VERIFICATION_DEFAULT_VALUE ) ) ); } } catch ( Exception ex ) { logger.error( ex ); } } logger.info( "Property '" + SKIP_USER_VERIFICATION_PROP_KEY + "' is '" + skipUserVerification + "'" ); }
private static void setSystemProperties() { ISystemConfig systemConfig = PentahoSystem.get( ISystemConfig.class ); if ( systemConfig == null ) { return; } final IConfiguration configuration = systemConfig.getConfiguration( JAVA_SYSTEM_PROPERTIES ); if ( configuration != null ) { try { final Properties systemSettingsProperties = configuration.getProperties(); for ( String propName : systemSettingsProperties.stringPropertyNames() ) { System.setProperty( propName, systemSettingsProperties.getProperty( propName ) ); } } catch ( IOException e ) { Logger.warn( PentahoSystem.class.getName(), Messages.getInstance() .getErrorString( "PentahoSystem.WARN_SYSTEM_PROPERTIES_READ_FAIL", JAVA_SYSTEM_PROPERTIES ) ); //$NON-NLS-1$ } } }
setProperty( testSystemPropertyName, testPropertyValue ); } } ); when( systemConfig.getConfiguration( eq( PentahoSystem.JAVA_SYSTEM_PROPERTIES ) ) ).thenReturn( configuration );