1 17 18 package tutorial; 19 20 import java.io.File ; 21 import java.util.Map ; 22 23 import org.apache.avalon.framework.context.ContextException; 24 import org.apache.avalon.framework.context.DefaultContext; 25 import org.apache.avalon.framework.context.Context; 26 27 34 public class StandardContextImp extends DefaultContext implements StandardContext 35 { 36 37 41 46 public StandardContextImp( Context context ) throws ContextException 47 { 48 super( context ); 49 } 50 51 55 59 public String getName() 60 { 61 try 62 { 63 return (String )super.get( StandardContext.NAME_KEY ); 64 } 65 catch( Throwable e ) 66 { 67 throw new IllegalStateException ( StandardContext.NAME_KEY ); 68 } 69 } 70 71 76 public String getPartitionName() 77 { 78 try 79 { 80 return (String )super.get( StandardContext.PARTITION_KEY ); 81 } 82 catch( Throwable e ) 83 { 84 throw new IllegalStateException ( StandardContext.PARTITION_KEY ); 85 } 86 } 87 88 92 public File getHomeDirectory() 93 { 94 try 95 { 96 return (File )super.get( StandardContext.HOME_KEY ); 97 } 98 catch( Throwable e ) 99 { 100 throw new IllegalStateException ( StandardContext.HOME_KEY ); 101 } 102 } 103 104 107 public File getWorkingDirectory() 108 { 109 try 110 { 111 return (File )super.get( StandardContext.WORKING_KEY ); 112 } 113 catch( Throwable e ) 114 { 115 throw new IllegalStateException ( StandardContext.WORKING_KEY ); 116 } 117 } 118 } 119 | Popular Tags |