Interface RemoteServiceAdmin
-
@ProviderType public interface RemoteServiceAdmin
A Remote Service Admin manages the import and export of services. A Distribution Provider can expose a control interface. This interface allows a Topology Manager to control the export and import of services. The API allows a Topology Manager to export a service, to import a service, and find out about the current imports and exports.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<ExportRegistration>
exportService(org.osgi.framework.ServiceReference<?> reference, java.util.Map<java.lang.String,?> properties)
Export a service to a given Endpoint.java.util.Collection<ExportReference>
getExportedServices()
Return the currently active Export References.java.util.Collection<ImportReference>
getImportedEndpoints()
Return the currently active Import References.ImportRegistration
importService(EndpointDescription endpoint)
Import a service from an Endpoint.
-
-
-
Method Detail
-
exportService
java.util.Collection<ExportRegistration> exportService(org.osgi.framework.ServiceReference<?> reference, java.util.Map<java.lang.String,?> properties)
Export a service to a given Endpoint. The Remote Service Admin must create an Endpoint from the given description that can be used by other Distribution Providers to connect to this Remote Service Admin and use the exported service. The property keys of a Service Reference are case insensitive while the property keys of the specifiedproperties
map are case sensitive. A property key in the specifiedproperties
map must therefore override any case variant property key in the properties of the specified Service Reference.If the caller does not have the appropriate
EndpointPermission[endpoint,EXPORT]
for an Endpoint, and the Java Runtime Environment supports permissions, then thegetException
method on the corresponding returnedExportRegistration
will return aSecurityException
.- Parameters:
reference
- The Service Reference to export.properties
- The properties to create a local Endpoint that can be implemented by this Remote Service Admin. If this isnull
, the Endpoint will be determined by the properties on the service. The properties are the same as given for an exported service. They override any properties in the specified Service Reference (case insensitive). The propertiesobjectClass
andservice.id
, in any case variant, are ignored. Those properties in the Service Reference cannot be overridden. This parameter can benull
, this should be treated as an empty map.- Returns:
- A
Collection
ofExportRegistration
s for the specified Service Reference and properties. Multiple Export Registrations may be returned because a single service can be exported to multiple Endpoints depending on the available configuration type properties and the intents that they support. The result is nevernull
but may be empty if this Remove Service Admin does not recognize any of the configuration types, or if the Remote Service Admin cannot support the relevant intents. - Throws:
java.lang.IllegalArgumentException
- If any of the properties for this configuration type has a value that is not syntactically correct, or if the service properties and the overlaid properties do not contain aRemoteConstants.SERVICE_EXPORTED_INTERFACES
entry. This means that implementations must not ignore invalid values for property names that they recognize.
-
importService
ImportRegistration importService(EndpointDescription endpoint)
Import a service from an Endpoint. The Remote Service Admin must use the given Endpoint to create a proxy. This method can returnnull
if the service could not be imported.- Parameters:
endpoint
- The Endpoint Description to be used for import.- Returns:
- An Import Registration that combines the Endpoint Description and
the Service Reference or
null
if the Endpoint could not be imported. - Throws:
java.lang.SecurityException
- If the caller does not have the appropriateEndpointPermission[endpoint,IMPORT]
for the Endpoint, and the Java Runtime Environment supports permissions.
-
getExportedServices
java.util.Collection<ExportReference> getExportedServices()
Return the currently active Export References.If the caller does not have the appropriate
EndpointPermission[endpoint,READ]
for an Endpoint, and the Java Runtime Environment supports permissions, then returned collection will not contain a reference to the exported Endpoint.- Returns:
- A
Collection
ofExportReference
s that are currently active.
-
getImportedEndpoints
java.util.Collection<ImportReference> getImportedEndpoints()
Return the currently active Import References.If the caller does not have the appropriate
EndpointPermission[endpoint,READ]
for an Endpoint, and the Java Runtime Environment supports permissions, then returned collection will not contain a reference to the imported Endpoint.- Returns:
- A
Collection
ofImportReference
s that are currently active.
-
-