1 /* 2 * $Header: /cvshome/build/org.osgi.service.device/src/org/osgi/service/device/DriverLocator.java,v 1.10 2006/07/12 21:22:12 hargrave Exp $ 3 * 4 * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved. 5 * 6 * Licensed 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 package org.osgi.service.device; 19 20 import java.io.IOException; 21 import java.io.InputStream; 22 import java.util.Dictionary; 23 24 /** 25 * A Driver Locator service can find and load device driver bundles given a 26 * property set. Each driver is represented by a unique <code>DRIVER_ID</code>. 27 * <p> 28 * Driver Locator services provide the mechanism for dynamically downloading new 29 * device driver bundles into an OSGi environment. They are supplied by 30 * providers and encapsulate all provider-specific details related to the 31 * location and acquisition of driver bundles. 32 * 33 * @version $Revision: 1.10 $ 34 * @see Driver 35 */ 36 public interface DriverLocator { 37 /** 38 * Returns an array of <code>DRIVER_ID</code> strings of drivers capable of 39 * attaching to a device with the given properties. 40 * 41 * <p> 42 * The property keys in the specified <code>Dictionary</code> objects are 43 * case-insensitive. 44 * 45 * @param props the properties of the device for which a driver is sought 46 * @return array of driver <code>DRIVER_ID</code> strings of drivers capable 47 * of attaching to a Device service with the given properties, or 48 * <code>null</code> if this Driver Locator service does not know of 49 * any such drivers 50 */ 51 public String[] findDrivers(Dictionary props); 52 53 /** 54 * Get an <code>InputStream</code> from which the driver bundle providing a 55 * driver with the giving <code>DRIVER_ID</code> can be installed. 56 * 57 * @param id the <code>DRIVER_ID</code> of the driver that needs to be 58 * installed. 59 * @return An <code>InputStream</code> object from which the driver bundle can 60 * be installed or <code>null</code> if the driver with the given ID 61 * cannot be located 62 * @throws java.io.IOException the input stream for the bundle cannot be 63 * created 64 */ 65 public InputStream loadDriver(String id) throws IOException; 66 } 67