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.ReadyAndReadyListener,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 TypeMethodDescriptionvoidAdds a pump to the pending list.voidadd(NozzlePipeline pipeline) Adds a pipeline to the nozzle.voidadd(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.intReturns the number of pumps that are currently blocked from pouring for some reason.com.tccc.kos.commons.core.context.BeanContextgetCtx()com.tccc.kos.commons.core.service.handle.HandleReturn the object add to a trouble impact list to block all pouring.ReturnIngredientPipelineServicefrom the associatedIngredientNozzlePipelineif installed.Return the metrics for the last beverage pour on this nozzle.com.tccc.kos.commons.core.service.trouble.TroubleMatchergetMetrics(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.booleanLocks the nozzle to the specified object.voidvoidonTroubleAdded(com.tccc.kos.commons.core.service.trouble.Trouble trouble) voidonTroubleRemoved(com.tccc.kos.commons.core.service.trouble.Trouble trouble) voidonTroubleResolved(com.tccc.kos.commons.core.service.trouble.Trouble trouble, boolean success) voidremove(NozzlePipeline pipeline) Removes a pipeline from the nozzle.removeMetrics(String name) Remove the metrics with the specified name from this nozzle.voidsetConfig(NozzleConfig config) voidTriggers pump validation.voidDecrements the nozzle lock count for the specified object.Methods inherited from class com.tccc.kos.commons.util.ready.ReadyBean
getReadyMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tccc.kos.core.service.assembly.AssemblyAware
getAssemblyNameMethods inherited from interface com.tccc.kos.commons.core.service.config.ConfigAware
onConfigChanged, onConfigSetMethods inherited from interface com.tccc.kos.commons.core.service.handle.ContextHandleAware
getHandlePrefixMethods inherited from interface com.tccc.kos.commons.core.context.CtxEventListener
onCtxDestroyed, onCtxPhaseCompletedMethods inherited from interface com.tccc.kos.commons.core.service.handle.HandleAware
addHandleChild, getPathMethods inherited from interface com.tccc.kos.ext.dispense.PourAvailability
getAvailbilityLockMethods inherited from interface com.tccc.kos.commons.util.ready.Ready
isReady, setReadyMethods inherited from interface com.tccc.kos.commons.util.ready.ReadyAndReadyListener
onBeanReady, onDependenciesReadyMethods 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
ReturnIngredientPipelineServicefrom the associatedIngredientNozzlePipelineif 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
-
removeMetrics
Remove the metrics with the specified name from this nozzle.- Parameters:
name- name of the metrics- Returns:
- the named metrics
-
onCtxAutowiringCompleted
public void onCtxAutowiringCompleted()- Specified by:
onCtxAutowiringCompletedin interfacecom.tccc.kos.commons.core.context.CtxEventListener
-
onTroubleAdded
public void onTroubleAdded(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
onTroubleAddedin 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:
onTroubleResolvedin interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
onTroubleRemoved
public void onTroubleRemoved(com.tccc.kos.commons.core.service.trouble.Trouble trouble) - Specified by:
onTroubleRemovedin interfacecom.tccc.kos.commons.core.service.trouble.TroubleAware
-
getMetricsService
-
getHandle
public com.tccc.kos.commons.core.service.handle.Handle getHandle()- Specified by:
getHandlein interfacecom.tccc.kos.commons.core.service.handle.HandleAware
-
getAssembly
public com.tccc.kos.core.service.assembly.Assembly getAssembly()- Specified by:
getAssemblyin interfacecom.tccc.kos.core.service.assembly.AssemblyAware
-
getName
- Specified by:
getNamein interfacecom.tccc.kos.commons.core.service.handle.HandleAware
-
getCtx
public com.tccc.kos.commons.core.context.BeanContext getCtx() -
getConfig
- Specified by:
getConfigin interfacecom.tccc.kos.commons.core.service.config.ConfigAware<NozzleConfig>
-
setConfig
- Specified by:
setConfigin interfacecom.tccc.kos.commons.core.service.config.ConfigAware<NozzleConfig>
-
getMatcher
public com.tccc.kos.commons.core.service.trouble.TroubleMatcher getMatcher()- Specified by:
getMatcherin interfacecom.tccc.kos.commons.core.service.trouble.TroubleListener
-
getBeverageAvailabilityLock
Description copied from interface:PourAvailabilityReturn the object add to a trouble impact list to block beverage pouring.- Specified by:
getBeverageAvailabilityLockin interfacePourAvailability
-
getIngredientAvailabilityLock
Description copied from interface:PourAvailabilityReturn the object add to a trouble impact list to block all pouring.- Specified by:
getIngredientAvailabilityLockin interfacePourAvailability
-