Package org.eclipse.ecf.osgi.services.remoteserviceadmin

## 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 if `IDiscoveryLocator`.

Since:
  4.8

### Nested Class Summary

Nested Classes
`class` `EndpointDescriptionLocator.EndpointEventListenerHolder`
`class` `EndpointDescriptionLocator.EndpointListenerHolder`

### Constructor Summary

Constructors
`EndpointDescriptionLocator​(BundleContext context)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()`
`void` `discoverEndpoint​(EndpointDescription endpointDescription)` Discover the given endpointDescription.
`protected Map<String,​Object>` `findOverrideProperties​(Bundle bundle, URL edFileRUL)` Find all override properties for given bundle at given fileURL.
`protected Map<String,​Object>` `findProperties​(Bundle bundle, URL edFileURL)` Find all override properties for given bundle at given fileURL.
`IDiscoveredEndpointDescriptionFactory` `getDiscoveredEndpointDescriptionFactory()`
`EndpointDescription[]` `getDiscoveredEndpoints()` Get endpoints discovered by this endpoint locator
`IDiscoveryAdvertiser[]` `getDiscoveryAdvertisers()`
`EndpointDescriptionLocator.EndpointEventListenerHolder[]` `getMatchingEndpointEventListenerHolders​(ServiceReference[] refs, EndpointDescription description, int type)`
`protected EndpointDescriptionLocator.EndpointEventListenerHolder[]` `getMatchingEndpointEventListenerHolders​(EndpointDescription description, int type)`
`EndpointDescriptionLocator.EndpointListenerHolder[]` `getMatchingEndpointListenerHolders​(ServiceReference[] refs, EndpointDescription description)`
`protected EndpointDescriptionLocator.EndpointListenerHolder[]` `getMatchingEndpointListenerHolders​(EndpointDescription description)`
`IServiceID` `getNetworkDiscoveredServiceID​(EndpointDescription endpointDescription)` Get the service ID associated with the given endpoint description.
`protected URL` `getPropsURL​(URL url, String newPath)` Get props url starting with given url with newPath rather than existing path.
`IServiceInfoFactory` `getServiceInfoFactory()`
`protected Map<String,​Object>` `loadAndProcessProperties​(Map<String,​Object> props, URL url)` Load and then process properties (merge with given props).
`protected EDEFProperties` `loadProperties​(URL url)` Load EDEF properties from given url.
`void` `start()`
`void` `undiscoverEndpoint​(EndpointDescription endpointDescription)` Remove the given endpointDescription.
`void` `updateEndpoint​(EndpointDescription endpointDescription)` Update the given endpointDescription.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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` - description
  `type` - 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 references
  `description` - description
  `type` - 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 be `null`.

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 be `null`.
  `url` - the URL to load properties from via `loadProperties(URL)`. May be `null`.
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 be `null`.
  `newPath` - new path to use with given url to create and return new url. Must not be `null`.
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 be `null`.
  `edFileURL` - the file URL to load properties file(s) from. Must not be `null`.
Returns:
  Map<String,Object> 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 be `null`.
  `edFileURL` - the file URL to load properties file(s) from. Must not be `null`.
Returns:
  Map<String,Object> 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 interface `IEndpointDescriptionLocator`
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 interface `IEndpointDescriptionLocator`
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 interface `IEndpointDescriptionLocator`
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 interface `IEndpointDescriptionLocator`
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 interface `IEndpointDescriptionLocator`
Returns:
  EndpointDescription[] of previously discovered endpoint. Will not return null, but may return empty array.
Since:
  4.3