1 50 package org.apache.avalon.fortress.examples.viewer; 51 52 import org.apache.avalon.fortress.impl.DefaultContainerManager; 53 import org.apache.avalon.fortress.util.FortressConfig; 54 import org.apache.avalon.fortress.ContainerManager; 55 import org.apache.avalon.framework.CascadingException; 56 import org.apache.avalon.framework.container.ContainerUtil; 57 58 65 public final class Main 66 { 67 71 public static final void main( String [] args ) 72 throws Exception 73 { 74 ContainerManager cm = null; 75 76 try 77 { 78 final FortressConfig config = new FortressConfig(); 79 config.setContainerClass( ComponentViewer.class ); 80 config.setContainerConfiguration( "resource://org/apache/avalon/fortress/examples/viewer/ComponentViewer.xconf" ); 81 config.setLoggerManagerConfiguration( "resource://org/apache/avalon/fortress/examples/viewer/ComponentViewer.xlog" ); 82 config.setInstrumentManagerConfiguration( "resource://org/apache/avalon/fortress/examples/viewer/ComponentViewer.instruments" ); 83 84 cm = new DefaultContainerManager( config.getContext() ); 85 org.apache.avalon.framework.container.ContainerUtil.initialize( cm ); 86 87 ( (ComponentViewer)cm.getContainer() ).run(); 88 } 89 catch( CascadingException e ) 90 { 91 e.printStackTrace(); 92 93 Throwable t = e.getCause(); 94 95 while( t != null ) 96 { 97 t.printStackTrace(); 98 99 t = t.getCause(); 100 } 101 } 102 finally 103 { 104 ContainerUtil.dispose( cm ); 105 } 106 } 107 } 108 109 | Popular Tags |