in jspwiki-main/src/main/java/org/apache/wiki/WikiEngine.java [239:347]
public void initialize( final Properties props ) throws WikiException {
m_startTime = new Date();
m_properties = props;
LOG.info( "*******************************************" );
LOG.info( "{} {} starting. Whee!", Release.APPNAME, Release.getVersionString() );
LOG.debug( "Java version: {}", System.getProperty( "java.runtime.version" ) );
LOG.debug( "Java vendor: {}", System.getProperty( "java.vm.vendor" ) );
LOG.debug( "OS: {} {} {}", System.getProperty( "os.name" ), System.getProperty( "os.version" ), System.getProperty( "os.arch" ) );
LOG.debug( "Default server locale: {}", Locale.getDefault() );
LOG.debug( "Default server timezone: {}", TimeZone.getDefault().getDisplayName( true, TimeZone.LONG ) );
if( m_servletContext != null ) {
LOG.info( "Servlet container: {}", m_servletContext.getServerInfo() );
if( m_servletContext.getMajorVersion() < 3 || ( m_servletContext.getMajorVersion() == 3 && m_servletContext.getMinorVersion() < 1 ) ) {
throw new InternalWikiException( "JSPWiki requires a container which supports at least version 3.1 of Servlet specification" );
}
}
fireEvent( WikiEngineEvent.INITIALIZING ); // begin initialization
LOG.debug( "Configuring WikiEngine..." );
createAndFindWorkingDirectory( props );
m_useUTF8 = StandardCharsets.UTF_8.name().equals( TextUtil.getStringProperty( props, PROP_ENCODING, StandardCharsets.ISO_8859_1.name() ) );
m_saveUserInfo = TextUtil.getBooleanProperty( props, PROP_STOREUSERNAME, m_saveUserInfo );
m_frontPage = TextUtil.getStringProperty( props, PROP_FRONTPAGE, "Main" );
m_templateDir = TextUtil.getStringProperty( props, PROP_TEMPLATEDIR, "default" );
enforceValidTemplateDirectory();
//
// Initialize the important modules. Any exception thrown by the managers means that we will not start up.
//
try {
final String aclClassName = m_properties.getProperty( PROP_ACL_MANAGER_IMPL, ClassUtil.getMappedClass( AclManager.class.getName() ).getName() );
final String urlConstructorClassName = TextUtil.getStringProperty( props, PROP_URLCONSTRUCTOR, "DefaultURLConstructor" );
final Class< URLConstructor > urlclass = ClassUtil.findClass( "org.apache.wiki.url", urlConstructorClassName );
initComponent( CommandResolver.class, this, props );
initComponent( urlclass.getName(), URLConstructor.class );
initComponent( CachingManager.class, this, props );
initComponent( PageManager.class, this, props );
initComponent( PluginManager.class, this, props );
initComponent( DifferenceManager.class, this, props );
initComponent( AttachmentManager.class, this, props );
initComponent( VariableManager.class, props );
initComponent( SearchManager.class, this, props );
initComponent( AuthenticationManager.class );
initComponent( AuthorizationManager.class );
initComponent( UserManager.class );
initComponent( GroupManager.class );
initComponent( EditorManager.class, this );
initComponent( ProgressManager.class, this );
initComponent( aclClassName, AclManager.class );
initComponent( WorkflowManager.class );
initComponent( TasksManager.class );
initComponent( InternationalizationManager.class, this );
initComponent( TemplateManager.class, this, props );
initComponent( FilterManager.class, this, props );
initComponent( AdminBeanManager.class, this );
initComponent( PageRenamer.class, this, props );
// RenderingManager depends on FilterManager events.
initComponent( RenderingManager.class );
// ReferenceManager has the side effect of loading all pages. Therefore, after this point, all page attributes are available.
// initReferenceManager is indirectly using m_filterManager, so it has to be called after it was initialized.
initReferenceManager();
// Hook the different manager routines into the system.
getManager( FilterManager.class ).addPageFilter( getManager( ReferenceManager.class ), -1001 );
getManager( FilterManager.class ).addPageFilter( getManager( SearchManager.class ), -1002 );
} catch( final RuntimeException e ) {
// RuntimeExceptions may occur here, even if they shouldn't.
LOG.fatal( "Failed to start managers.", e );
throw new WikiException( "Failed to start managers: " + e.getMessage(), e );
} catch( final ClassNotFoundException e ) {
LOG.fatal( "JSPWiki could not start, URLConstructor was not found: {}", e.getMessage(), e );
throw new WikiException( e.getMessage(), e );
} catch( final InstantiationException e ) {
LOG.fatal( "JSPWiki could not start, URLConstructor could not be instantiated: {}", e.getMessage(), e );
throw new WikiException( e.getMessage(), e );
} catch( final IllegalAccessException e ) {
LOG.fatal( "JSPWiki could not start, URLConstructor cannot be accessed: {}", e.getMessage(), e );
throw new WikiException( e.getMessage(), e );
} catch( final Exception e ) {
// Final catch-all for everything
LOG.fatal( "JSPWiki could not start, due to an unknown exception when starting.", e );
throw new WikiException( "Failed to start. Caused by: " + e.getMessage() + "; please check log files for better information.", e );
}
// Initialize the good-to-have-but-not-fatal modules.
try {
if( TextUtil.getBooleanProperty( props, RSSGenerator.PROP_GENERATE_RSS,false ) ) {
initComponent( RSSGenerator.class, this, props );
}
} catch( final Exception e ) {
LOG.error( "Unable to start RSS generator - JSPWiki will still work, but there will be no RSS feed.", e );
}
final Map< String, String > extraComponents = ClassUtil.getExtraClassMappings();
initExtraComponents( extraComponents );
fireEvent( WikiEngineEvent.INITIALIZED ); // initialization complete
LOG.info( "WikiEngine configured." );
m_isConfigured = true;
}