Package net.shibboleth.shared.testing

# Class MockReloadableService<T>

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.shared.service.AbstractReloadableService<T>
net.shibboleth.shared.testing.MockReloadableService<T>

Type Parameters:
  `T` - type of component

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `UnmodifiableComponent`, `ReloadableService<T>`

public class MockReloadableService<T> extends AbstractReloadableService<T>
Utility class for wrapping a serviceable component in a dummy reloadable service.

## Nested Class Summary

## Nested classes/interfaces inherited from class net.shibboleth.shared.service.AbstractReloadableService

`AbstractReloadableService.ServiceReloadTask`

## Field Summary

Fields
Modifier and Type
Field
Description
`private final SpringServiceableComponent<T>`
`component`
The component we are presenting to provide.

## Constructor Summary

Constructors
Constructor
Description
`MockReloadableService()`
Default constructor.
`MockReloadableService(T what)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`ServiceableComponent<T>`
`getServiceableComponent()`
Get the serviceable component that this service supports.
`protected boolean`
`shouldReload()`
Called by the `AbstractReloadableService<T>.ServiceReloadTask` to determine if the service should be reloaded.

### Methods inherited from class net.shibboleth.shared.service.AbstractReloadableService

`doDestroy, doInitialize, doReload, getLastReloadAttemptInstant, getLastSuccessfulReloadInstant, getLogPrefix, getReloadCheckDelay, getReloadFailureCause, getReloadTaskTimer, isFailFast, reload, setFailFast, setReloadCheckDelay, setReloadTaskTimer`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, initialize, isDestroyed, isInitialized`

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

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

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### component

@Nullable private final SpringServiceableComponent<T> component
The component we are presenting to provide.

## Constructor Details

### MockReloadableService

public MockReloadableService()
Default constructor.

### MockReloadableService

public MockReloadableService(@Nullable T what)
Constructor.

Parameters:
  `what` - component

## Method Details

### getServiceableComponent

@Nonnull public ServiceableComponent<T> getServiceableComponent()
Get the serviceable component that this service supports. If the component hasn't been successfully loaded yet or if this service does not support a ServiceableComponent, a `ServiceException` is raised.

On a non-null value, the returned component will be pinned and MUST be closed. This can be done by exploiting the fact that a ServiceableComponent implements `AutoCloseable`

Returns:
  the component, if appropriate.

### shouldReload

protected boolean shouldReload()
Called by the `AbstractReloadableService<T>.ServiceReloadTask` to determine if the service should be reloaded.

No lock is held when this method is called, so any locking needed should be handled internally.

Specified by:
  `shouldReload` in class `AbstractReloadableService<T>`
Returns:
  true iff the service should be reloaded