1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 /* 19 * $Id$ 20 */ 21 22 package org.apache.qetest; 23 import java.util.Properties; 24 25 /** 26 * Interface with basic configuration API's. 27 * 28 * A simple interface allowing configuration of testing utilities; 29 * generally by passing generic information to the testing 30 * utility and having it pass it to any underlying objects. 31 * 32 * @author Shane_Curcuru@lotus.com 33 * @version $Id$ 34 */ 35 public interface Configurable 36 { 37 /** 38 * Allows the user to set specific attributes on the testing 39 * utility or it's underlying product object under test. 40 * 41 * This method may or may not throw an IllegalArgumentException 42 * if an attribute that it does not recognize is passed in. 43 * This decision is up to the individual testing utility, and 44 * may include deciding to either trap underlying product 45 * exceptions for unknown attributes, or may re-throw them as 46 * IllegalArgumentExceptions. 47 * 48 * Modeled after JAXP's various setAttribute()/setFeature() 49 * methods. 50 * 51 * @param name The name of the attribute. 52 * @param value The value of the attribute. 53 * @throws IllegalArgumentException thrown if the underlying 54 * implementation doesn't recognize the attribute and wants to 55 * inform the user of this fact. 56 */ setAttribute(String name, Object value)57 public void setAttribute(String name, Object value) 58 throws IllegalArgumentException; 59 60 61 /** 62 * Allows the user to set specific attributes on the testing 63 * utility or it's underlying product object under test. 64 * 65 * This method should attempt to set any applicable attributes 66 * found in the given attrs onto itself, and will ignore any and 67 * all attributes it does not recognize. It should never 68 * throw exceptions. This method may overwrite any previous 69 * attributes that were set. Currently since this takes a 70 * Properties block you may only be able to set objects that 71 * are Strings, although individual implementations may 72 * attempt to use Hashtable.get() on only the local part. 73 * 74 * @param attrs Props of various name, value attrs. 75 */ applyAttributes(Properties attrs)76 public void applyAttributes(Properties attrs); 77 78 79 /** 80 * Allows the user to retrieve specific attributes on the testing 81 * utility or it's underlying product object under test. 82 * 83 * @param name The name of the attribute. 84 * @return value The value of the attribute. 85 * @throws IllegalArgumentException thrown if the underlying 86 * implementation doesn't recognize the attribute and wants to 87 * inform the user of this fact. 88 */ getAttribute(String name)89 public Object getAttribute(String name) 90 throws IllegalArgumentException; 91 92 93 /** 94 * Description of what this testing utility does. 95 * 96 * @return String description of extension 97 */ getDescription()98 public String getDescription(); 99 100 } // end of class Configurable 101 102