KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > device > DriverSelector


1 /*
2  * $Header: /cvshome/build/org.osgi.service.device/src/org/osgi/service/device/DriverSelector.java,v 1.9 2006/06/16 16:31:29 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2001, 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 org.osgi.framework.ServiceReference;
21
22 /**
23  * When the device manager detects a new Device service, it calls all registered
24  * Driver services to determine if anyone matches the Device service. If at
25  * least one Driver service matches, the device manager must choose one. If
26  * there is a Driver Selector service registered with the Framework, the device
27  * manager will ask it to make the selection. If there is no Driver Selector
28  * service, or if it returns an invalid result, or throws an <code>Exception</code>,
29  * the device manager uses the default selection strategy.
30  *
31  * @version $Revision: 1.9 $
32  * @since 1.1
33  */

34 public interface DriverSelector {
35     /**
36      * Return value from <code>DriverSelector.select</code>, if no Driver service
37      * should be attached to the Device service. The value is -1.
38      */

39     public static final int SELECT_NONE = -1;
40
41     /**
42      * Select one of the matching Driver services. The device manager calls this
43      * method if there is at least one driver bidding for a device. Only Driver
44      * services that have responded with nonzero (not {@link Device#MATCH_NONE})
45      * <code></code> match values will be included in the list.
46      *
47      * @param reference the <code>ServiceReference</code> object of the Device
48      * service.
49      * @param matches the array of all non-zero matches.
50      * @return index into the array of <code>Match</code> objects, or
51      * <code>SELECT_NONE</code> if no Driver service should be attached
52      */

53     public int select(ServiceReference reference, Match[] matches);
54 }
55
Popular Tags