Skip to main content
summaryrefslogtreecommitdiffstats
blob: d5bc9c086553efbba18c4d454b36e7cc19ca88c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*******************************************************************************
 * Copyright (c) 2003, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.osgi.framework.adaptor;

import org.osgi.framework.*;

/**
 * The ServiceRegistry interface is used by the framework to store and
 * lookup currently registered services.
 * <p>
 * Clients may implement this interface.
 * </p>
 * @since 3.1
 */
public interface ServiceRegistry {

	/**
	 * Publishes a service to this ServiceRegistry.
	 * @param context the BundleContext that registered the service.
	 * @param serviceReg the ServiceRegistration to register.
	 */
	public void publishService(BundleContext context, ServiceRegistration serviceReg);

	/**
	 * Unpublishes a service from this ServiceRegistry
	 * @param context the BundleContext that registered the service. 
	 * @param serviceReg the ServiceRegistration to unpublish.
	 */
	public void unpublishService(BundleContext context, ServiceRegistration serviceReg);

	/**
	 * Unpublishes all services from this ServiceRegistry that the
	 * specified BundleContext registered.
	 * @param context the BundleContext to unpublish all services for.
	 */
	public void unpublishServices(BundleContext context);

	/**
	 * Performs a lookup for ServiceReferences that are bound to this 
	 * ServiceRegistry. If both clazz and filter are null then all bound
	 * ServiceReferences are returned.
	 * @param clazz A fully qualified class name.  All ServiceReferences that
	 * reference an object that implement this class are returned.  May be
	 * null.
	 * @param filter Used to match against published Services.  All 
	 * ServiceReferences that match the filter are returned.  If a clazz is
	 * specified then all ServiceReferences that match the clazz and the
	 * filter parameter are returned. May be null.
	 * @return An array of all matching ServiceReferences or null
	 * if none exist.
	 */
	public ServiceReference[] lookupServiceReferences(String clazz, Filter filter);

	/**
	 * Performs a lookup for ServiceReferences that are bound to this 
	 * ServiceRegistry using the specified BundleContext.
	 * @param context The BundleContext to lookup the ServiceReferences on.
	 * @return An array of all matching ServiceReferences or null if none
	 * exist.
	 */
	public ServiceReference[] lookupServiceReferences(BundleContext context);

}

Back to the top