/** * Constructor. */ public YAAFIContainer() { this.enableLogging( new ConsoleLogger( logLevel ) ); this.config = new ServiceContainerConfiguration(); }
/** * Constructor. * * @param logLevel the log level to be used */ public YAAFIContainer(int logLevel) { this.logLevel = logLevel; this.enableLogging( new ConsoleLogger( logLevel ) ); this.config = new ServiceContainerConfiguration(); }
/** * Initialize the instance * * @throws Exception the initialization failed */ public void initialize() throws Exception { this.getLogger().debug( "Initializing " + this.getClass().getName() ); ServiceContainerConfiguration config = new ServiceContainerConfiguration(); // initialize the Avalon container config.setLogger( this.getLogger() ); config.setApplicationRootDir( this.getApplicationHome() ); config.setTempRootDir( this.getTempHome() ); config.loadContainerConfiguration( this.getContainerConfigValue(), "auto" ); this.container = ServiceContainerFactory.create( config ); // initialize shutdown hook of JVM for a server application if( this.hasShutdownHook() ) { this.getLogger().debug( "Registering shutdown hook" ); Shutdown shutdown = new Shutdown( this ); this.shutdownThread = new Thread( shutdown, "ShutdownThread" ); Runtime.getRuntime().addShutdownHook( this.shutdownThread ); } this.setInitialized(true); }
/** * Initialize the instance * * @throws Exception the initialization failed */ public void initialize() throws Exception { this.getLogger().debug( "Initializing " + this.getClass().getName() ); ServiceContainerConfiguration config = new ServiceContainerConfiguration(); // initialize the Avalon container config.setLogger( this.getLogger() ); config.setApplicationRootDir( this.getApplicationHome() ); config.setTempRootDir( this.getTempHome() ); config.loadContainerConfiguration( this.getContainerConfigValue(), "auto" ); this.container = ServiceContainerFactory.create( config ); // initialize shutdown hook of JVM for a server application if( this.hasShutdownHook() ) { this.getLogger().debug( "Registering shutdown hook" ); Shutdown shutdown = new Shutdown( this ); this.shutdownThread = new Thread( shutdown, "ShutdownThread" ); Runtime.getRuntime().addShutdownHook( this.shutdownThread ); } this.setInitialized(true); }