Module org.refcodes.rest
Package org.refcodes.rest
Class AbstractHttpDiscoverySidecar<B extends HttpDiscoverySidecar<B>>
java.lang.Object
org.refcodes.rest.AbstractHttpDiscoverySidecar<B>
- Type Parameters:
B- the generic type
- All Implemented Interfaces:
org.refcodes.component.Configurable<HttpDiscoveryContext>,org.refcodes.component.Destroyable,org.refcodes.component.Destroyable.DestroyAutomaton,org.refcodes.component.Initializable,org.refcodes.component.Initializable.InitializeAutomaton,org.refcodes.component.InitializedAccessor,org.refcodes.component.LifecycleComponent,org.refcodes.component.LifecycleComponent.LifecycleAutomaton,org.refcodes.component.LifecycleStatusAccessor,org.refcodes.component.Pausable,org.refcodes.component.Pausable.PauseAutomaton,org.refcodes.component.Resumable,org.refcodes.component.Resumable.ResumeAutomaton,org.refcodes.component.RunningAccessor,org.refcodes.component.Startable,org.refcodes.component.Startable.StartAutomaton,org.refcodes.component.Stoppable,org.refcodes.component.Stoppable.StopAutomaton,HttpDiscovery<B>,HttpDiscoverySidecar<B>,HttpDiscoveryUrlAccessor,HttpDiscoveryUrlAccessor.HttpDiscoveryUrlBuilder<B>,HttpDiscoveryUrlAccessor.HttpDiscoveryUrlMutator,HttpDiscoveryUrlAccessor.HttpDiscoveryUrlProperty,org.refcodes.security.TrustStoreDescriptorAccessor,org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorBuilder<B>,org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorMutator,org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorProperty,org.refcodes.web.LoadBalancingStrategyAccessor,org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyBuilder<B>,org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyMutator,org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyProperty
public abstract class AbstractHttpDiscoverySidecar<B extends HttpDiscoverySidecar<B>>
extends Object
implements HttpDiscoverySidecar<B>
Abstract class for easily decorating a
HttpRegistrySidecar.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.component.Configurable
org.refcodes.component.Configurable.ConfigureAutomaton<CTX extends Object>, org.refcodes.component.Configurable.ConfigureBuilder<CTX extends Object,B extends org.refcodes.component.Configurable.ConfigureBuilder<CTX, B>> Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable
org.refcodes.component.Destroyable.DestroyAutomatonNested classes/interfaces inherited from interface org.refcodes.rest.HttpDiscoveryUrlAccessor
HttpDiscoveryUrlAccessor.HttpDiscoveryUrlBuilder<B extends HttpDiscoveryUrlAccessor.HttpDiscoveryUrlBuilder<B>>, HttpDiscoveryUrlAccessor.HttpDiscoveryUrlMutator, HttpDiscoveryUrlAccessor.HttpDiscoveryUrlPropertyNested classes/interfaces inherited from interface org.refcodes.component.Initializable
org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializableNested classes/interfaces inherited from interface org.refcodes.component.InitializedAccessor
org.refcodes.component.InitializedAccessor.InitializedMutator, org.refcodes.component.InitializedAccessor.InitializedPropertyNested classes/interfaces inherited from interface org.refcodes.component.LifecycleComponent
org.refcodes.component.LifecycleComponent.LifecycleAutomaton, org.refcodes.component.LifecycleComponent.UncheckedLifecycleComponentNested classes/interfaces inherited from interface org.refcodes.component.LifecycleStatusAccessor
org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusBuilder<B extends org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusBuilder<B>>, org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusMutator, org.refcodes.component.LifecycleStatusAccessor.LifecycleStatusPropertyNested classes/interfaces inherited from interface org.refcodes.web.LoadBalancingStrategyAccessor
org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyBuilder<B extends org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyBuilder<B>>, org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyMutator, org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyPropertyNested classes/interfaces inherited from interface org.refcodes.component.Pausable
org.refcodes.component.Pausable.PauseAutomaton, org.refcodes.component.Pausable.PauseBuilder<B extends org.refcodes.component.Pausable.PauseBuilder<B>>, org.refcodes.component.Pausable.UncheckedPausableNested classes/interfaces inherited from interface org.refcodes.component.Resumable
org.refcodes.component.Resumable.ResumeAutomaton, org.refcodes.component.Resumable.ResumeBuilder<B extends org.refcodes.component.Resumable.ResumeBuilder<B>>, org.refcodes.component.Resumable.UncheckedResumableNested classes/interfaces inherited from interface org.refcodes.component.RunningAccessor
org.refcodes.component.RunningAccessor.RunningMutator, org.refcodes.component.RunningAccessor.RunningPropertyNested classes/interfaces inherited from interface org.refcodes.component.Startable
org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Startable.StartBuilder<B extends org.refcodes.component.Startable.StartBuilder<B>>, org.refcodes.component.Startable.UncheckedStartableNested classes/interfaces inherited from interface org.refcodes.component.Stoppable
org.refcodes.component.Stoppable.StopAutomaton, org.refcodes.component.Stoppable.StopBuilder<B extends org.refcodes.component.Stoppable.StopBuilder<B>>, org.refcodes.component.Stoppable.UncheckedStoppableNested classes/interfaces inherited from interface org.refcodes.security.TrustStoreDescriptorAccessor
org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorBuilder<B extends org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorBuilder<B>>, org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorMutator, org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorProperty -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.refcodes.component.LifecycleMachine.ManualLifecycleMachine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Stops resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.org.refcodes.web.UrlRetrieves the URL from the URL property locating the service discovery discovery.org.refcodes.component.LifecycleStatusorg.refcodes.web.LoadBalancingStrategyorg.refcodes.security.TrustStoreDescriptorvoidInitially fetches the list of available services and their accordingly associatedUrlfrom the discovery service.booleanbooleanbooleanbooleanbooleanbooleanisPaused()booleanbooleanbooleanbooleanbooleanvoidpause()Pauses the resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.voidresume()Resumes the resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.voidsetHttpDiscoveryUrl(org.refcodes.web.Url aUrl) Sets the URL for the URL property locating the service discovery discovery.voidsetLoadBalancingStrategy(org.refcodes.web.LoadBalancingStrategy aStrategy) voidsetTrustStoreDescriptor(org.refcodes.security.TrustStoreDescriptor aTrustStoreDescriptor) voidstart()Starts resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.voidstop()Stops resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.protected static org.refcodes.web.UrltoHttpDiscoveryUrl(org.refcodes.web.Url aDiscoveryUrl, HttpDiscoveryUrlAccessor.HttpDiscoveryUrlProperty aProperty) Resolves the property from the provided value and the provided property and the and sets the property in case the provided value is not null.protected static org.refcodes.web.LoadBalancingStrategytoLoadBalancingStrategy(org.refcodes.web.LoadBalancingStrategy aStrategy, org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyProperty aProperty) Resolves the property from the provided value and the provided property and the and sets the property in case the provided value is not null.protected static org.refcodes.security.TrustStoreDescriptortoTrustStoreDescriptor(org.refcodes.security.TrustStoreDescriptor aStoreDescriptor, org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorProperty aProperty) Resolves the property from the provided value and the provided property and the and sets the property in case the provided value is not null.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.component.Configurable
initializeUncheckedMethods inherited from interface org.refcodes.rest.HttpDiscovery
initialize, initialize, initialize, initialize, initialize, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, toUrl, withHttpDiscoveryUrl, withLoadBalancingStrategyMethods inherited from interface org.refcodes.rest.HttpDiscoverySidecar
withTrustStoreDescriptorMethods inherited from interface org.refcodes.rest.HttpDiscoveryUrlAccessor.HttpDiscoveryUrlProperty
letHttpDiscoveryUrlMethods inherited from interface org.refcodes.component.Initializable
initializeUncheckedMethods inherited from interface org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyProperty
letLoadBalancingStrategyMethods inherited from interface org.refcodes.component.Pausable
pauseUncheckedMethods inherited from interface org.refcodes.component.Resumable
resumeUncheckedMethods inherited from interface org.refcodes.component.Startable
startUncheckedMethods inherited from interface org.refcodes.component.Stoppable
stopUncheckedMethods inherited from interface org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorProperty
letTrustStoreDescriptor
-
Field Details
-
_lifeCycleAutomaton
protected org.refcodes.component.LifecycleMachine.ManualLifecycleMachine _lifeCycleAutomaton
-
-
Constructor Details
-
AbstractHttpDiscoverySidecar
public AbstractHttpDiscoverySidecar()
-
-
Method Details
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.refcodes.component.RunningAccessor
-
isInitialized
public boolean isInitialized()- Specified by:
isInitializedin interfaceorg.refcodes.component.InitializedAccessor
-
getLifecycleStatus
public org.refcodes.component.LifecycleStatus getLifecycleStatus()- Specified by:
getLifecycleStatusin interfaceorg.refcodes.component.LifecycleStatusAccessor
-
pause
public void pause() throws org.refcodes.component.PauseExceptionPauses the resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.- Specified by:
pausein interfaceHttpDiscovery<B extends HttpDiscoverySidecar<B>>- Specified by:
pausein interfaceorg.refcodes.component.Pausable- Throws:
org.refcodes.component.PauseException
-
stop
public void stop() throws org.refcodes.component.StopExceptionStops resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service. Does not update the list of available services and their accordingly associatedUrlfrom the discovery service. This may be achieved by canceling a scheduler.- Specified by:
stopin interfaceHttpDiscovery<B extends HttpDiscoverySidecar<B>>- Specified by:
stopin interfaceorg.refcodes.component.Stoppable- Throws:
org.refcodes.component.StopException
-
start
public void start() throws org.refcodes.component.StartExceptionStarts resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service. Takes care to update the list of available services and their accordingly associatedUrlfrom the discovery service. This may be achieved by starting a scheduler. If necessary, the connection is opened.- Specified by:
startin interfaceHttpDiscovery<B extends HttpDiscoverySidecar<B>>- Specified by:
startin interfaceorg.refcodes.component.Startable- Throws:
org.refcodes.component.StartException
-
resume
public void resume() throws org.refcodes.component.ResumeExceptionResumes the resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service.- Specified by:
resumein interfaceHttpDiscovery<B extends HttpDiscoverySidecar<B>>- Specified by:
resumein interfaceorg.refcodes.component.Resumable- Throws:
org.refcodes.component.ResumeException
-
initialize
public void initialize() throws org.refcodes.component.InitializeExceptionInitially fetches the list of available services and their accordingly associatedUrlfrom the discovery service. Sets up the client according to the current client's state when invokingHttpDiscovery.initialize(Url, LoadBalancingStrategy, TrustStoreDescriptor).- Specified by:
initializein interfaceHttpDiscovery<B extends HttpDiscoverySidecar<B>>- Specified by:
initializein interfaceorg.refcodes.component.Initializable- Throws:
org.refcodes.component.InitializeException
-
isStoppable
public boolean isStoppable()- Specified by:
isStoppablein interfaceorg.refcodes.component.Stoppable.StopAutomaton
-
isPausable
public boolean isPausable()- Specified by:
isPausablein interfaceorg.refcodes.component.Pausable.PauseAutomaton
-
isStartable
public boolean isStartable()- Specified by:
isStartablein interfaceorg.refcodes.component.Startable.StartAutomaton
-
isResumable
public boolean isResumable()- Specified by:
isResumablein interfaceorg.refcodes.component.Resumable.ResumeAutomaton
-
isStopped
public boolean isStopped()- Specified by:
isStoppedin interfaceorg.refcodes.component.Stoppable.StopAutomaton
-
isPaused
public boolean isPaused()- Specified by:
isPausedin interfaceorg.refcodes.component.Pausable.PauseAutomaton
-
isInitalizable
public boolean isInitalizable()- Specified by:
isInitalizablein interfaceorg.refcodes.component.Initializable.InitializeAutomaton
-
destroy
public void destroy()Stops resolving of the host part of anUrlfrom the list of available services and their accordingly associatedUrlas of the discovery service. Does not update the list of available services and their accordingly associatedUrlfrom the discovery service. This may be achieved by canceling a scheduler. Finally the connection is closed.- Specified by:
destroyin interfaceorg.refcodes.component.Destroyable- Specified by:
destroyin interfaceHttpDiscovery<B extends HttpDiscoverySidecar<B>>
-
isDestroyable
public boolean isDestroyable()- Specified by:
isDestroyablein interfaceorg.refcodes.component.Destroyable.DestroyAutomaton
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyedin interfaceorg.refcodes.component.Destroyable.DestroyAutomaton
-
getLoadBalancingStrategy
public org.refcodes.web.LoadBalancingStrategy getLoadBalancingStrategy()- Specified by:
getLoadBalancingStrategyin interfaceorg.refcodes.web.LoadBalancingStrategyAccessor
-
setHttpDiscoveryUrl
public void setHttpDiscoveryUrl(org.refcodes.web.Url aUrl) Sets the URL for the URL property locating the service discovery discovery.- Specified by:
setHttpDiscoveryUrlin interfaceHttpDiscoveryUrlAccessor.HttpDiscoveryUrlMutator- Parameters:
aUrl- The service discovery discovery URL to be stored by the URL property.
-
setLoadBalancingStrategy
public void setLoadBalancingStrategy(org.refcodes.web.LoadBalancingStrategy aStrategy) - Specified by:
setLoadBalancingStrategyin interfaceorg.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyMutator
-
getTrustStoreDescriptor
public org.refcodes.security.TrustStoreDescriptor getTrustStoreDescriptor()- Specified by:
getTrustStoreDescriptorin interfaceorg.refcodes.security.TrustStoreDescriptorAccessor
-
setTrustStoreDescriptor
public void setTrustStoreDescriptor(org.refcodes.security.TrustStoreDescriptor aTrustStoreDescriptor) - Specified by:
setTrustStoreDescriptorin interfaceorg.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorMutator
-
getHttpDiscoveryUrl
public org.refcodes.web.Url getHttpDiscoveryUrl()Retrieves the URL from the URL property locating the service discovery discovery.- Specified by:
getHttpDiscoveryUrlin interfaceHttpDiscoveryUrlAccessor- Returns:
- The URL stored by the URL property.
-
toLoadBalancingStrategy
protected static org.refcodes.web.LoadBalancingStrategy toLoadBalancingStrategy(org.refcodes.web.LoadBalancingStrategy aStrategy, org.refcodes.web.LoadBalancingStrategyAccessor.LoadBalancingStrategyProperty aProperty) Resolves the property from the provided value and the provided property and the and sets the property in case the provided value is not null.- Parameters:
aStrategy- The value to be used when not null.aProperty- The property to be used when the value is null and which is to be set when the value is not null.- Returns:
- The value when not null, else the value of the provided property.
-
toTrustStoreDescriptor
protected static org.refcodes.security.TrustStoreDescriptor toTrustStoreDescriptor(org.refcodes.security.TrustStoreDescriptor aStoreDescriptor, org.refcodes.security.TrustStoreDescriptorAccessor.TrustStoreDescriptorProperty aProperty) Resolves the property from the provided value and the provided property and the and sets the property in case the provided value is not null.- Parameters:
aStoreDescriptor- The value to be used when not null.aProperty- The property to be used when the value is null and which is to be set when the value is not null.- Returns:
- The value when not null, else the value of the provided property.
-
toHttpDiscoveryUrl
protected static org.refcodes.web.Url toHttpDiscoveryUrl(org.refcodes.web.Url aDiscoveryUrl, HttpDiscoveryUrlAccessor.HttpDiscoveryUrlProperty aProperty) Resolves the property from the provided value and the provided property and the and sets the property in case the provided value is not null.- Parameters:
aDiscoveryUrl- The value to be used when not null.aProperty- The property to be used when the value is null and which is to be set when the value is not null.- Returns:
- The value when not null, else the value of the provided property.
-