Package org.apache.sling.resourceresolver.impl.providers

# Class ResourceProviderHandler

java.lang.Object
org.apache.sling.resourceresolver.impl.providers.ResourceProviderHandler

All Implemented Interfaces:
  `Comparable<ResourceProviderHandler>`, `Pathable`

public class ResourceProviderHandler extends Object implements Comparable<ResourceProviderHandler>, Pathable
Holder for a resource provider service.

## Constructor Summary

Constructors
Constructor
Description
`ResourceProviderHandler(ResourceProviderInfo info, org.apache.sling.spi.resource.provider.ResourceProvider<Object> provider)`
Create a new handler

## Method Summary

Modifier and Type
Method
Description
`void`
`activate()`
Start the resource provder
`int`
`compareTo(ResourceProviderHandler o)`
`void`
`deactivate()`
Deactivate this handler.
`ResourceProviderInfo`
`getInfo()`
Get the resource provider info
`String`
`getPath()`
Get the path where the provider is mounted.
`ProviderContextImpl`
`getProviderContext()`
Get the provider context.
`org.apache.sling.spi.resource.provider.ResourceProvider<Object>`
`getResourceProvider()`
Get the resource provider.
`boolean`
`isUsed()`
Check whether this provider has been used.
`String`
`toString()`
`void`
`update()`
Update the provider
`org.apache.sling.spi.resource.provider.ResourceProvider<Object>`
`useResourceProvider()`
Get the resource provider and mark it as used.

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

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

## Constructor Details

### ResourceProviderHandler

public ResourceProviderHandler(ResourceProviderInfo info, org.apache.sling.spi.resource.provider.ResourceProvider<Object> provider)
Create a new handler

Parameters:
  `info` - Resource provider info.
  `provider` - The resource provider

## Method Details

### getInfo

public ResourceProviderInfo getInfo()
Get the resource provider info

Returns:
  The resource provider info or `null` if this handler has been deactivated.

### activate

public void activate()
Start the resource provder

### deactivate

public void deactivate()
Deactivate this handler. Unget the provider service.

### getResourceProvider

public org.apache.sling.spi.resource.provider.ResourceProvider<Object> getResourceProvider()
Get the resource provider.

Returns:
  The resource provider or `null` if it is not active.

### useResourceProvider

public org.apache.sling.spi.resource.provider.ResourceProvider<Object> useResourceProvider()
Get the resource provider and mark it as used.

Returns:
  The resource provider or `null` if it is not active.

### isUsed

public boolean isUsed()
Check whether this provider has been used.

Returns:
  `true` if used

### compareTo

public int compareTo(ResourceProviderHandler o)

Specified by:
  `compareTo` in interface `Comparable<ResourceProviderHandler>`

### getPath

public String getPath()
Get the path where the provider is mounted.

Specified by:
  `getPath` in interface `Pathable`
Returns:
  The mount path.

### update

public void update()
Update the provider

### getProviderContext

public ProviderContextImpl getProviderContext()
Get the provider context.

Returns:
  The provider context

### toString

public String toString()

Overrides:
  `toString` in class `Object`