/** * Add a new entry to the context by creating a new one. * * @param name the name of the new entry * @param value the value of the new entry */ public void addToContext(String name, Object value) { Validate.notEmpty(name, "name"); Validate.notNull(value, "value"); this.getContext().put(name, value); }
/** * Add a new entry to the context by creating a new one. * @param name the name of the new entry * @param value the value of the new entry */ public void addToContext( String name, Object value ) { Validate.notEmpty(name,"name"); Validate.notNull(value,"value"); this.getContext().put( name, value ); }
/** * Create the final Avalon context passed to YAAFI containing * <ul> * <li>user-supplied context</li> * <li>urn:avalon:home</li> * <li>urn:avalon:temp</li> * <li>urn:avalon:name</li> * <li>urn:avalon:partition</li> * <li>urn:avalon:classloader</li> * </ul> * * @return the final Context * @throws Exception if filename not defined * @throws IOException if file not found */ public Context createFinalContext() throws IOException, Exception { // 1) add the application root dir this.addToContext(AvalonMerlinConstants.URN_AVALON_HOME, this.getApplicationRootDir()); // 2) add the temp root dir this.addToContext(AvalonMerlinConstants.URN_AVALON_TEMP, this.getTempRootDir()); // 3) add the Avalon name this.addToContext(AvalonMerlinConstants.URN_AVALON_NAME, ServiceConstants.ROLE_NAME); // 4) add the Avalon partition name this.addToContext(AvalonMerlinConstants.URN_AVALON_PARTITION, "root"); // 5) add the class loader this.addToContext(AvalonMerlinConstants.URN_AVALON_CLASSLOADER, this.getComponentClassLoader()); return this.getContext(); }
); return this.getContext();