Class EndpointDescriptionLocator
- java.lang.Object
-
- org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator
-
- All Implemented Interfaces:
IEndpointDescriptionLocator
public class EndpointDescriptionLocator extends Object implements IEndpointDescriptionLocator
Implementation of EndpointDescription discovery mechanism, using any/all ECF discovery providers (implementers ifIDiscoveryLocator
.- Since:
- 4.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
EndpointDescriptionLocator.EndpointEventListenerHolder
class
EndpointDescriptionLocator.EndpointListenerHolder
-
Constructor Summary
Constructors Constructor Description EndpointDescriptionLocator(BundleContext context)
-
Method Summary
-
-
-
Constructor Detail
-
EndpointDescriptionLocator
public EndpointDescriptionLocator(BundleContext context)
-
-
Method Detail
-
start
public void start()
-
close
public void close()
-
getDiscoveryAdvertisers
public IDiscoveryAdvertiser[] getDiscoveryAdvertisers()
-
getServiceInfoFactory
public IServiceInfoFactory getServiceInfoFactory()
-
getDiscoveredEndpointDescriptionFactory
public IDiscoveredEndpointDescriptionFactory getDiscoveredEndpointDescriptionFactory()
-
getMatchingEndpointListenerHolders
protected EndpointDescriptionLocator.EndpointListenerHolder[] getMatchingEndpointListenerHolders(EndpointDescription description)
-
getMatchingEndpointEventListenerHolders
protected EndpointDescriptionLocator.EndpointEventListenerHolder[] getMatchingEndpointEventListenerHolders(EndpointDescription description, int type)
- Parameters:
description
- descriptiontype
- type- Returns:
- EndpointEventListenerHolder[] matching endpoint event listener holders
- Since:
- 4.1
-
getMatchingEndpointEventListenerHolders
public EndpointDescriptionLocator.EndpointEventListenerHolder[] getMatchingEndpointEventListenerHolders(ServiceReference[] refs, EndpointDescription description, int type)
- Parameters:
refs
- service referencesdescription
- descriptiontype
- type- Returns:
- EndpointEventListenerHolder[] matching endpoint event listener holders
- Since:
- 4.1
-
getMatchingEndpointListenerHolders
public EndpointDescriptionLocator.EndpointListenerHolder[] getMatchingEndpointListenerHolders(ServiceReference[] refs, EndpointDescription description)
-
loadProperties
protected EDEFProperties loadProperties(URL url) throws IOException
Load EDEF properties from given url. Provided url must not benull
.- Parameters:
url
- the URL to load the properties from.- Returns:
- EDEFProperties instance. Will not be
null
. - Throws:
IOException
- if properties cannot be read via EDEFProperties.load(InputStream)- Since:
- 4.8
-
loadAndProcessProperties
protected Map<String,Object> loadAndProcessProperties(Map<String,Object> props, URL url)
Load and then process properties (merge with given props).- Parameters:
props
- the props to merge with. Should not benull
.url
- the URL to load properties from vialoadProperties(URL)
. May benull
.- Returns:
- properties loaded and merged with provided props. Returns props unmodified if url is null or load exception.
- Since:
- 4.8
-
getPropsURL
protected URL getPropsURL(URL url, String newPath)
Get props url starting with given url with newPath rather than existing path.- Parameters:
url
- the based URL to start with. Uses proptocol, host, port. Must not benull
.newPath
- new path to use with given url to create and return new url. Must not benull
.- Returns:
- url created from given url with newPath. Will be
null
if MalformedURLException thrown. - Since:
- 4.8
-
findOverrideProperties
protected Map<String,Object> findOverrideProperties(Bundle bundle, URL edFileRUL)
Find all override properties for given bundle at given fileURL. Will load edef_defaults.properties files and edef_defaults-[value of system property: org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator.localPropertiesFile].properties.- Parameters:
bundle
- the bundle responsible for the given fileURL. Must not benull
.edFileURL
- the file URL to load properties file(s) from. Must not benull
.- Returns:
- Map
containing all properties to override those in xml from edFileURL paths and edFileURL file name with .properties suffix. - Since:
- 4.7
-
findProperties
protected Map<String,Object> findProperties(Bundle bundle, URL edFileURL)
Find all override properties for given bundle at given fileURL. Will load edef_defaults.properties files and edef_defaults-[value of system property: org.eclipse.ecf.osgi.services.remoteserviceadmin.EndpointDescriptionLocator.localPropertiesFile].properties.- Parameters:
bundle
- the bundle responsible for the given fileURL. Must not benull
.edFileURL
- the file URL to load properties file(s) from. Must not benull
.- Returns:
- Map
containing all properties to override those in xml from edFileURL paths and edFileURL file name with .properties suffix. - Since:
- 4.8
-
getNetworkDiscoveredServiceID
public IServiceID getNetworkDiscoveredServiceID(EndpointDescription endpointDescription)
Description copied from interface:IEndpointDescriptionLocator
Get the service ID associated with the given endpoint description.- Specified by:
getNetworkDiscoveredServiceID
in interfaceIEndpointDescriptionLocator
- Parameters:
endpointDescription
- endpoint description- Returns:
- IServiceID associated discovered endpoint description. Will
return
null
if no associated serviceID - Since:
- 4.3
-
discoverEndpoint
public void discoverEndpoint(EndpointDescription endpointDescription)
Description copied from interface:IEndpointDescriptionLocator
Discover the given endpointDescription. This method will not block and will result in local EndpointEventListeners to be notified that the given endpointDescription is discovered. about- Specified by:
discoverEndpoint
in interfaceIEndpointDescriptionLocator
- Parameters:
endpointDescription
- must not be null- Since:
- 4.3
-
updateEndpoint
public void updateEndpoint(EndpointDescription endpointDescription)
Description copied from interface:IEndpointDescriptionLocator
Update the given endpointDescription. This method will not block and will result in local EndpointEventListeners to be notified that the given endpointDescription is updated. about- Specified by:
updateEndpoint
in interfaceIEndpointDescriptionLocator
- Parameters:
endpointDescription
- must not be null- Since:
- 4.3
-
undiscoverEndpoint
public void undiscoverEndpoint(EndpointDescription endpointDescription)
Description copied from interface:IEndpointDescriptionLocator
Remove the given endpointDescription. This method will not block and will result in local EndpointEventListeners to be notified that the given endpointDescription is removed. about- Specified by:
undiscoverEndpoint
in interfaceIEndpointDescriptionLocator
- Parameters:
endpointDescription
- must not be null- Since:
- 4.3
-
getDiscoveredEndpoints
public EndpointDescription[] getDiscoveredEndpoints()
Description copied from interface:IEndpointDescriptionLocator
Get endpoints discovered by this endpoint locator- Specified by:
getDiscoveredEndpoints
in interfaceIEndpointDescriptionLocator
- Returns:
- EndpointDescription[] of previously discovered endpoint. Will not return null, but may return empty array.
- Since:
- 4.3
-
-