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 int getDampeningTimeout() { if ( dampeningTimeout == null ) { dampeningTimeout = 0; ISystemConfig iSystemConfig = PentahoSystem.get( ISystemConfig.class ); if ( iSystemConfig != null ) { String property = iSystemConfig.getProperty( "system.dampening-timeout" ); if ( property != null ) { dampeningTimeout = Integer.valueOf( property ); } } } return dampeningTimeout; }
/** * Overridden to: * <ul> * <li>Store {@code configuration} for later passing to {@link PentahoEntryCollector}.</li> * <li>Add JCR_READ_ACCESS_CONTROL to root ACL. This is harmless and avoids more customization.</li> * </ul> */ @Override @SuppressWarnings( "rawtypes" ) public void init( final Session systemSession, final Map conf ) throws RepositoryException { this.configuration = conf; ISystemConfig settings = PentahoSystem.get( ISystemConfig.class ); if ( settings != null ) { useCachingEntryCollector = "true".equals( settings.getProperty( "system.cachingEntryCollector" ) ); } super.init( systemSession, conf ); // original initRootACL should run during super.init call above updateRootAcl( (SessionImpl) systemSession, new ACLEditor( session, this, false /* allowUnknownPrincipals */ ) ); this.initialized = true; registerEntryCollectorWithObservationManager( systemSession ); }
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 + "'" ); }
when( config.getProperty( "system.dampening-timeout" ) ).thenReturn( "3000" );
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$ } } }
RepositoryFile.Builder newFolder = new RepositoryFile.Builder( username ).folder( true ); String hidePropertyValue = PentahoSystem.get( ISystemConfig.class ) .getProperty( PentahoSystem.HIDE_USER_HOME_FOLDER_ON_CREATION_PROPERTY ); Boolean hideUserHomeFolder = hidePropertyValue != null && "true".equals( hidePropertyValue.toLowerCase() ); newFolder = newFolder.hidden( hideUserHomeFolder );
setProperty( testSystemPropertyName, testPropertyValue ); } } ); when( systemConfig.getConfiguration( eq( PentahoSystem.JAVA_SYSTEM_PROPERTIES ) ) ).thenReturn( configuration );