Class Nozzle
- All Implemented Interfaces:
com.tccc.kos.commons.core.context.CtxEventListener
,com.tccc.kos.commons.core.service.config.ConfigAware<NozzleConfig>
,com.tccc.kos.commons.core.service.handle.ContextHandleAware
,com.tccc.kos.commons.core.service.handle.HandleAware
,com.tccc.kos.commons.core.service.trouble.TroubleAware
,com.tccc.kos.commons.core.service.trouble.TroubleListener
,com.tccc.kos.commons.util.ready.Ready
,com.tccc.kos.commons.util.ready.ReadyListener
,com.tccc.kos.core.service.assembly.AssemblyAware
,PourAvailability
A nozzle has an associated list of pumps (and therefore, ingredients) which are connected to it. A nozzle can have one more pipelines, which are used for pouring from the nozzle.
Pipelines are constructed within the BeanContext
of the nozzle, which
keeps the pipelines of one nozzle isolated from the pipelines of other nozzles.
This allows multiple pipelines to contain instances of the same service, which
operate independently but can be autowired within the pipeline.
The handles to objects are also context-relative, so if the same service appears on multiple pipelines in multiple nozzles, then each instance will have a distinct path and therefore distinct configuration settings.
- Since:
- 1.0
- Version:
- 2023-01-13
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tccc.kos.ext.dispense.PourAvailability
PourAvailability.Type
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a pump to the pending list.void
add
(NozzlePipeline pipeline) Adds a pipeline to the nozzle.void
add
(Collection<? extends Pump<?>> pumps) Adds a list of pumps to the pending list.addMetrics
(String name) Register metrics associated with this nozzle.com.tccc.kos.core.service.assembly.Assembly
<T extends NozzlePipeline>
TgetAssignablePipeline
(Class<T> type) Get the pipeline that is an instance of the specified type.Return the object add to a trouble impact list to block beverage pouring.int
Returns the number of pumps that are currently blocked from pouring for some reason.com.tccc.kos.commons.core.context.BeanContext
getCtx()
com.tccc.kos.commons.core.service.handle.Handle
Return the object add to a trouble impact list to block all pouring.ReturnIngredientPipelineService
from the associatedIngredientNozzlePipeline
if installed.Return the metrics for the last beverage pour on this nozzle.com.tccc.kos.commons.core.service.trouble.TroubleMatcher
getMetrics
(String name) Return the metrics with the specified name for this nozzle.getName()
<T extends NozzlePipeline>
TgetPipeline
(Class<T> type) Get the pipeline with the specified type.Return the pipelines associated with this nozzle.Collection<Pump<?>>
getPumps()
Returns the list of pumps attached to this nozzle.boolean
Locks the nozzle to the specified object.void
void
onTroubleAdded
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) void
onTroubleRemoved
(com.tccc.kos.commons.core.service.trouble.Trouble trouble) void
onTroubleResolved
(com.tccc.kos.commons.core.service.trouble.Trouble trouble, boolean success) void
remove
(NozzlePipeline pipeline) Removes a pipeline from the nozzle.void
setConfig
(NozzleConfig config) void
Triggers pump validation.void
Decrements the nozzle lock count for the specified object.Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReady, onBeanReady, onDependenciesReady
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.core.service.assembly.AssemblyAware
getAssemblyName
Methods inherited from interface com.tccc.kos.commons.core.service.config.ConfigAware
onConfigChanged, onConfigSet
Methods inherited from interface com.tccc.kos.commons.core.service.handle.ContextHandleAware
getHandlePrefix
Methods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxDestroyed, onCtxPhaseCompleted
Methods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getPath
Methods inherited from interface com.tccc.kos.ext.dispense.PourAvailability
getAvailbilityLock
Methods inherited from interface com.tccc.kos.commons.util.ready.Ready
isReady, setReady
Methods inherited from interface com.tccc.kos.commons.util.ready.ReadyListener
onDependenciesGroupReady
-
Constructor Details
-
Nozzle
Creates a new nozzle with the specified name and parent context (typically the system context).
-
-
Method Details
-
lock
Locks the nozzle to the specified object. If there is no lock, this becomes the lock object. Additional lock calls using this object increments the lock count. Corresponding calls to unlock with the same object decrements the lock count. When the count reaches zero, the nozzle lock is available to be claimed by a different object.The object used for the lock is typically a pipeline object or a key service within a pipeline.
- Parameters:
ref
- the object the lock request is relative to
-
unlock
Decrements the nozzle lock count for the specified object. This is only meaningful if the specified object currently holds the nozzle lock. In this case the use count is decremented. Once the use count reaches zero, then the lock is released and the nozzle is available to be locked by some other pipeline.- Parameters:
ref
- the object used to acquire the lock
-
triggerPumpValidation
public void triggerPumpValidation()Triggers pump validation. -
getBlockedPumpCount
public int getBlockedPumpCount()Returns the number of pumps that are currently blocked from pouring for some reason. -
getPumps
Returns the list of pumps attached to this nozzle. -
add
Adds a pump to the pending list. This pump becomes active in the nozzle when the associated assembly is installed, and is removed when the assembly is uninstalled. -
add
Adds a list of pumps to the pending list. These pumps become active in the nozzle when the associated assembly is installed, and is removed when the assembly is uninstalled. -
add
Adds a pipeline to the nozzle. A pipeline can only be installed to a single nozzle.- Parameters:
pipeline
- the pipeline to add
-
remove
Removes a pipeline from the nozzle.- Parameters:
pipeline
- the pipeline to remove
-
getPipelines
Return the pipelines associated with this nozzle. -
getPipeline
Get the pipeline with the specified type.- Parameters:
type
- the class to match
-
getAssignablePipeline
Get the pipeline that is an instance of the specified type. This will match pipelines that are subclasses of the specified type.- Parameters:
type
- the class to match
-
getIngredientPipelineService
ReturnIngredientPipelineService
from the associatedIngredientNozzlePipeline
if installed. This provides easy access to ingredient based pouring using intents. -
getLastBeveragePourMetrics
Return the metrics for the last beverage pour on this nozzle. -
addMetrics
Register metrics associated with this nozzle. These will be updated with pour data regardless of how the ingredient is poured (both beverage and ingredient pours). Adding a name that already exists will simply callresetMetrics()
on the existing metrics.Internal metrics cannot be replaced and will throw
InvalidMetricsException
.- Parameters:
name
- name of the metrics- Returns:
- the associated metrics
-
getMetrics
Return the metrics with the specified name for this nozzle.- Parameters:
name
- name of the metrics- Returns:
- the named metrics
-
onCtxAutowiringCompleted
public void onCtxAutowiringCompleted()- Specified by:
onCtxAutowiringCompleted
in interfacecom.tccc.kos.commons.core.context.CtxEventListener
-
onTroubleAdded
public void onTroubleAdded(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
onTroubleAdded
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
onTroubleResolved
public void onTroubleResolved(com.tccc.kos.commons.core.service.trouble.Trouble trouble, boolean success) - Specified by:
onTroubleResolved
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
onTroubleRemoved
public void onTroubleRemoved(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
onTroubleRemoved
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
getMetricsService
-
getHandle
public com.tccc.kos.commons.core.service.handle.Handle getHandle()- Specified by:
getHandle
in interfacecom.tccc.kos.commons.core.service.handle.HandleAware
-
getAssembly
public com.tccc.kos.core.service.assembly.Assembly getAssembly()- Specified by:
getAssembly
in interfacecom.tccc.kos.core.service.assembly.AssemblyAware
-
getName
- Specified by:
getName
in interfacecom.tccc.kos.commons.core.service.handle.HandleAware
-
getCtx
public com.tccc.kos.commons.core.context.BeanContext getCtx() -
getConfig
- Specified by:
getConfig
in interfacecom.tccc.kos.commons.core.service.config.ConfigAware<NozzleConfig>
-
setConfig
- Specified by:
setConfig
in interfacecom.tccc.kos.commons.core.service.config.ConfigAware<NozzleConfig>
-
getMatcher
public com.tccc.kos.commons.core.service.trouble.TroubleMatcher getMatcher()- Specified by:
getMatcher
in interfacecom.tccc.kos.commons.core.service.trouble.TroubleListener
-
getBeverageAvailabilityLock
Description copied from interface:PourAvailability
Return the object add to a trouble impact list to block beverage pouring.- Specified by:
getBeverageAvailabilityLock
in interfacePourAvailability
-
getIngredientAvailabilityLock
Description copied from interface:PourAvailability
Return the object add to a trouble impact list to block all pouring.- Specified by:
getIngredientAvailabilityLock
in interfacePourAvailability
-