Package org.apache.sling.discovery

# Interface InstanceDescription

@ProviderType public interface InstanceDescription
An InstanceDescription represents and contains information about an instance that is part of a TopologyView.

Note that all methods are idempotent - they always return the same values on subsequent calls. Rather, on any change new InstanceDescriptions are created.

See Also:
  - `TopologyView`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`PROPERTY_DESCRIPTION`
Property containing a description for the instance.
`static final String`
`PROPERTY_ENDPOINTS`
Property containing endpoints to connect to the instance.
`static final String`
`PROPERTY_NAME`
Property containing a name for the instance.

## Method Summary

Modifier and Type
Method
Description
`ClusterView`
`getClusterView()`
Returns the ClusterView of which this instance is part of.
`Map<String,String>`
`getProperties()`
Returns a Map containing all properties of this instance.
`String`
`getProperty(String name)`
Returns the value of a particular property.
`String`
`getSlingId()`
The identifier of the running Sling instance.
`boolean`
`isLeader()`
If an instance is part of a cluster, it can potentially be a leader of that cluster - this information is queried here.
`boolean`
`isLocal()`
Determines whether this InstanceDescription is representing the local instance.

## Field Details

### PROPERTY_NAME

static final String PROPERTY_NAME
Property containing a name for the instance. The instance should provide this property.

See Also:
  - Constant Field Values

### PROPERTY_DESCRIPTION

static final String PROPERTY_DESCRIPTION
Property containing a description for the instance. The instance should provide this property.

See Also:
  - Constant Field Values

### PROPERTY_ENDPOINTS

static final String PROPERTY_ENDPOINTS
Property containing endpoints to connect to the instance. The value is a comma separated list. The instance should provide this property.

See Also:
  - Constant Field Values

## Method Details

### getClusterView

ClusterView getClusterView()
Returns the ClusterView of which this instance is part of. Every instance is part of a ClusterView even if it is standalone.

Returns:
  the ClusterView

### isLeader

boolean isLeader()
If an instance is part of a cluster, it can potentially be a leader of that cluster - this information is queried here. If an instance is not part of a cluster, this method returns true. Only one instance of a cluster is guaranteed to be the leader at any time. This guarantee is provided by this service. If the leader goes down, the service elects a new leader and announces it to TopologyEventListener listeners.

Returns:
  true if this instance is the - only - leader in this cluster, false if it is one of the slaves, or true if it is not at all part of a cluster

### isLocal

boolean isLocal()
Determines whether this InstanceDescription is representing the local instance.

Returns:
  whether this InstanceDescription is representing the local instance.

### getSlingId

String getSlingId()
The identifier of the running Sling instance.

Returns:
  the identifier of this instance

### getProperty

String getProperty(String name)
Returns the value of a particular property. Note that there are no hard guarantees or requirements as to how quickly a property is available once it is set on a distant instance.

Parameters:
  `name` - The property name
Returns:
  The value of the property or `null`

### getProperties

Map<String,String> getProperties()
Returns a Map containing all properties of this instance. This method always returns a map, it might be empty. The returned map is not modifiable.

Returns:
  a Map containing all properties of this instance