KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > framework > adaptor > ServiceRegistry


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.osgi.framework.adaptor;
13
14 import org.osgi.framework.*;
15
16 /**
17  * The ServiceRegistry interface is used by the framework to store and
18  * lookup currently registered services.
19  * <p>
20  * Clients may implement this interface.
21  * </p>
22  * @since 3.1
23  */

24 public interface ServiceRegistry {
25
26     /**
27      * Publishes a service to this ServiceRegistry.
28      * @param context the BundleContext that registered the service.
29      * @param serviceReg the ServiceRegistration to register.
30      */

31     public void publishService(BundleContext context, ServiceRegistration serviceReg);
32
33     /**
34      * Unpublishes a service from this ServiceRegistry
35      * @param context the BundleContext that registered the service.
36      * @param serviceReg the ServiceRegistration to unpublish.
37      */

38     public void unpublishService(BundleContext context, ServiceRegistration serviceReg);
39
40     /**
41      * Unpublishes all services from this ServiceRegistry that the
42      * specified BundleContext registered.
43      * @param context the BundleContext to unpublish all services for.
44      */

45     public void unpublishServices(BundleContext context);
46
47     /**
48      * Performs a lookup for ServiceReferences that are bound to this
49      * ServiceRegistry. If both clazz and filter are null then all bound
50      * ServiceReferences are returned.
51      * @param clazz A fully qualified class name. All ServiceReferences that
52      * reference an object that implement this class are returned. May be
53      * null.
54      * @param filter Used to match against published Services. All
55      * ServiceReferences that match the filter are returned. If a clazz is
56      * specified then all ServiceReferences that match the clazz and the
57      * filter parameter are returned. May be null.
58      * @return An array of all matching ServiceReferences or null
59      * if none exist.
60      */

61     public ServiceReference[] lookupServiceReferences(String JavaDoc clazz, Filter filter);
62
63     /**
64      * Performs a lookup for ServiceReferences that are bound to this
65      * ServiceRegistry using the specified BundleContext.
66      * @param context The BundleContext to lookup the ServiceReferences on.
67      * @return An array of all matching ServiceReferences or null if none
68      * exist.
69      */

70     public ServiceReference[] lookupServiceReferences(BundleContext context);
71
72 }
73
Popular Tags