public abstract class Application
extends java.lang.Object
Application represents a per-web-application singleton object where applications based on Jakarta Server Faces (or implementations wishing to provide extended functionality) can register application-wide singletons that provide functionality required by Jakarta Server Faces. Default implementations of each object are provided for cases where the application does not choose to customize the behavior.
The instance of Application
is created by calling the getApplication()
method of ApplicationFactory
. Because this instance is shared, it must be implemented in
a thread-safe manner.
The application also acts as a factory for several types of Objects specified in the Faces
Configuration file. Please see createComponent(java.lang.String)
,
createConverter(java.lang.String)
, and createValidator(java.lang.String)
.
| Constructor and Description |
|---|
Application() |
| Modifier and Type | Method and Description |
|---|---|
void |
addBehavior(java.lang.String behaviorId,
java.lang.String behaviorClass)
Register a new mapping of behavior id to the name of
the corresponding
Behavior class. |
abstract void |
addComponent(java.lang.String componentType,
java.lang.String componentClass)
Register a new mapping of component type to the name of the corresponding
UIComponent
class. |
abstract void |
addConverter(java.lang.Class<?> targetClass,
java.lang.String converterClass)
Register a new converter class that is capable of performing conversions for the specified
target class.
|
abstract void |
addConverter(java.lang.String converterId,
java.lang.String converterClass)
Register a new mapping of converter id to the name of the corresponding
Converter
class. |
void |
addDefaultValidatorId(java.lang.String validatorId)
Register a validator by its id that is applied to all |
void |
addELContextListener(ELContextListener listener)
Provide a way for Faces applications to register an
ELContextListener that will
be notified on creation of ELContext instances. |
void |
addELResolver(ELResolver resolver)
Cause an the argument
resolver
to be added to the resolver chain as specified in section JSF.5.5.1 of the Jakarta Server Faces
Specification. |
void |
addSearchKeywordResolver(SearchKeywordResolver resolver)
Cause the argument |
abstract void |
addValidator(java.lang.String validatorId,
java.lang.String validatorClass)
Register a new mapping of validator id to the name of the corresponding
Validator
class. |
Behavior |
createBehavior(java.lang.String behaviorId)
Instantiate and return a new
Behavior instance
of the class specified by a previous call to addBehavior() for the specified
behavior id. |
UIComponent |
createComponent(FacesContext context,
Resource componentResource)
Instantiate and return a new
|
UIComponent |
createComponent(FacesContext context,
java.lang.String componentType,
java.lang.String rendererType)
Like |
abstract UIComponent |
createComponent(java.lang.String componentType)
Instantiate and return a new
UIComponent
instance of the class specified by a previous call to addComponent() for the
specified component type. |
abstract UIComponent |
createComponent(ValueBinding componentBinding,
FacesContext context,
java.lang.String componentType)
Deprecated.
This has been replaced by
createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String) . |
UIComponent |
createComponent(ValueExpression componentExpression,
FacesContext context,
java.lang.String componentType)
|
UIComponent |
createComponent(ValueExpression componentExpression,
FacesContext context,
java.lang.String componentType,
java.lang.String rendererType)
Like |
abstract Converter |
createConverter(java.lang.Class<?> targetClass)
Instantiate and return a new
Converter
instance of the class that has registered itself as capable of performing conversions for
objects of the specified type. |
abstract Converter |
createConverter(java.lang.String converterId)
Instantiate and return a new
Converter
instance of the class specified by a previous call to addConverter() for the
specified converter id. |
abstract MethodBinding |
createMethodBinding(java.lang.String ref,
java.lang.Class<?>[] params)
Deprecated.
This has been replaced by calling
getExpressionFactory() then
ExpressionFactory.createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[]) . |
abstract Validator |
createValidator(java.lang.String validatorId)
Instantiate and return a new
Validator
instance of the class specified by a previous call to addValidator() for the
specified validator id. |
abstract ValueBinding |
createValueBinding(java.lang.String ref)
Deprecated.
This has been replaced by calling
getExpressionFactory() then
ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>) . |
<T> T |
evaluateExpressionGet(FacesContext context,
java.lang.String expression,
java.lang.Class<? extends T> expectedType)
Get a value by evaluating an expression.
|
abstract ActionListener |
getActionListener()
Return the default
ActionListener to be
registered for all ActionSource components in this application. |
java.util.Iterator<java.lang.String> |
getBehaviorIds()
Return an
Iterator over the set of currently registered behavior ids for this
Application . |
abstract java.util.Iterator<java.lang.String> |
getComponentTypes()
Return an
Iterator over the set of currently defined component types for this
Application . |
abstract java.util.Iterator<java.lang.String> |
getConverterIds()
Return an
Iterator over the set of currently registered converter ids for this
Application . |
abstract java.util.Iterator<java.lang.Class<?>> |
getConverterTypes()
Return an
Iterator over the set of Class instances for which
Converter classes have been explicitly registered. |
abstract java.util.Locale |
getDefaultLocale()
Return the default
Locale for this application. |
abstract java.lang.String |
getDefaultRenderKitId()
Return the
renderKitId to be used for rendering this application. |
java.util.Map<java.lang.String,java.lang.String> |
getDefaultValidatorInfo()
Return an immutable |
ELContextListener[] |
getELContextListeners()
If no calls have been made to
addELContextListener(javax.el.ELContextListener) , this method must return an empty
array. |
ELResolver |
getELResolver()
Return the singleton
ELResolver instance to be used for all Jakarta Expression Language resolution. |
ExpressionFactory |
getExpressionFactory()
Return the
ExpressionFactory instance for this application. |
FlowHandler |
getFlowHandler()
Return the thread-safe singleton |
abstract java.lang.String |
getMessageBundle()
Return the fully qualified class name of the
ResourceBundle to be used for
Jakarta Server Faces messages for this application. |
abstract NavigationHandler |
getNavigationHandler()
Return the
NavigationHandler instance that will be passed the outcome returned by any
invoked application action for this web application. |
ProjectStage |
getProjectStage()
Return the project stage for the currently running application instance. |
abstract PropertyResolver |
getPropertyResolver()
Deprecated.
This has been replaced by
getELResolver() . |
java.util.ResourceBundle |
getResourceBundle(FacesContext ctx,
java.lang.String name)
Find a
ResourceBundle as defined in the application configuration resources
under the specified name. |
ResourceHandler |
getResourceHandler()
Return the singleton, stateless, thread-safe |
SearchExpressionHandler |
getSearchExpressionHandler()
Return the thread-safe singleton |
SearchKeywordResolver |
getSearchKeywordResolver()
Return the singleton |
abstract StateManager |
getStateManager()
Return the
StateManager instance that will be utilized during the Restore
View and Render Response phases of the request processing lifecycle. |
abstract java.util.Iterator<java.util.Locale> |
getSupportedLocales()
Return an
Iterator over the supported Locale s for this appication. |
abstract java.util.Iterator<java.lang.String> |
getValidatorIds()
Return an
Iterator over the set of currently registered validator ids for this
Application . |
abstract VariableResolver |
getVariableResolver()
Deprecated.
This has been replaced by
getELResolver() . |
abstract ViewHandler |
getViewHandler()
Return the
ViewHandler instance that will be utilized during the Restore
View and Render Response phases of the request processing lifecycle. |
void |
publishEvent(FacesContext context,
java.lang.Class<? extends SystemEvent> systemEventClass,
java.lang.Class<?> sourceBaseType,
java.lang.Object source)
This method functions exactly like |
void |
publishEvent(FacesContext context,
java.lang.Class<? extends SystemEvent> systemEventClass,
java.lang.Object source)
If |
void |
removeELContextListener(ELContextListener listener)
Remove the argument
listener from the list of ELContextListener s. |
abstract void |
setActionListener(ActionListener listener)
Set the default
ActionListener to be registered for all
ActionSource components. |
abstract void |
setDefaultLocale(java.util.Locale locale)
Set the default
Locale for this application. |
abstract void |
setDefaultRenderKitId(java.lang.String renderKitId)
Set the
renderKitId to be used to render this application. |
void |
setFlowHandler(FlowHandler newHandler)
Set the |
abstract void |
setMessageBundle(java.lang.String bundle)
Set the fully qualified class name of the
ResourceBundle to be used for
Jakarta Server Faces messages for this application. |
abstract void |
setNavigationHandler(NavigationHandler handler)
Set the
NavigationHandler instance that will be passed the outcome returned by any
invoked application action for this web application. |
abstract void |
setPropertyResolver(PropertyResolver resolver)
Deprecated.
The recommended way to affect the execution of the Jakarta Expression Language is to provide an
<el-resolver> element at the right place in the application
configuration resources which will be considered in the normal course of
expression evaluation. This method now will cause the argument
resolver to be wrapped inside an implementation of
ELResolver and exposed to the Jakarta Expression Language resolution system as if the user had
called addELResolver(javax.el.ELResolver) . |
void |
setResourceHandler(ResourceHandler resourceHandler)
Set the |
void |
setSearchExpressionHandler(SearchExpressionHandler searchExpressionHandler)
Set the |
abstract void |
setStateManager(StateManager manager)
Set the
StateManager instance that will be utilized during the Restore View
and Render Response phases of the request processing lifecycle. |
abstract void |
setSupportedLocales(java.util.Collection<java.util.Locale> locales)
Set the
Locale instances representing the supported Locale s for
this application. |
abstract void |
setVariableResolver(VariableResolver resolver)
Deprecated.
The recommended way to affect the execution of the Jakarta Expression Language is to provide an
<el-resolver> element at the
right place in the application configuration resources which will be considered
in the normal course of expression evaluation. This method now will cause the
argument resolver to be wrapped inside an implementation of
ELResolver and exposed to the Jakarta Expression Language resolution system as if the user had
called addELResolver(javax.el.ELResolver) . |
abstract void |
setViewHandler(ViewHandler handler)
Set the
ViewHandler instance that will be utilized during the Restore View
and Render Response phases of the request processing lifecycle. |
void |
subscribeToEvent(java.lang.Class<? extends SystemEvent> systemEventClass,
java.lang.Class<?> sourceClass,
SystemEventListener listener)
Install the listener instance referenced by
argument |
void |
subscribeToEvent(java.lang.Class<? extends SystemEvent> systemEventClass,
SystemEventListener listener)
Install the listener instance referenced by
argument |
void |
unsubscribeFromEvent(java.lang.Class<? extends SystemEvent> systemEventClass,
java.lang.Class<?> sourceClass,
SystemEventListener listener)
Remove the listener instance referenced by argument
|
void |
unsubscribeFromEvent(java.lang.Class<? extends SystemEvent> systemEventClass,
SystemEventListener listener)
Remove the listener instance referenced by argument
|
public abstract ActionListener getActionListener()
Return the default ActionListener
to be
registered for all ActionSource
components in this application.
If not explicitly set, a default implementation must be provided that performs the
functions as specified in the section titled
"ActionListener Property" in the chapter titled "Application Integration" of the spec prose
document.
Note that the specification for the default ActionListener
contiues to call for
the use of a deprecated property (action
) and class
(MethodBinding
). Unfortunately, this is necessary because the default
ActionListener
must continue to work with components that do not implement
ActionSource2
, and only implement
ActionSource
.
public abstract void setActionListener(ActionListener listener)
Set the default ActionListener
to be registered for all
ActionSource
components.
listener
- The new default ActionListener
java.lang.NullPointerException
- if listener
is null
public abstract java.util.Locale getDefaultLocale()
Return the default Locale
for this application. If not explicitly set,
null
is returned.
null
.public abstract void setDefaultLocale(java.util.Locale locale)
Set the default Locale
for this application.
locale
- The new default Locale
java.lang.NullPointerException
- if locale
is null
public abstract java.lang.String getDefaultRenderKitId()
Return the renderKitId
to be used for rendering this application. If not
explicitly set, null
is returned.
null
.public abstract void setDefaultRenderKitId(java.lang.String renderKitId)
Set the renderKitId
to be used to render this application. Unless the client has
provided a custom ViewHandler
that supports the use of multiple
RenderKit
instances in the same application, this method must only
be called at application startup, before any Faces requests have been processed. This is a
limitation of the current Specification, and may be lifted in a future release.
renderKitId
- the render kit id to set.public abstract java.lang.String getMessageBundle()
Return the fully qualified class name of the ResourceBundle
to be used for
Jakarta Server Faces messages for this application. If not explicitly set, null
is
returned.
null
.public abstract void setMessageBundle(java.lang.String bundle)
Set the fully qualified class name of the ResourceBundle
to be used for
Jakarta Server Faces messages for this application. See the JavaDocs for the
java.util.ResourceBundle
class for more information about the syntax for
resource bundle names.
bundle
- Base name of the resource bundle to be usedjava.lang.NullPointerException
- if bundle
is null
public abstract NavigationHandler getNavigationHandler()
Return the NavigationHandler
instance that will be passed the outcome returned by any
invoked application action for this web application. If not explicitly set, a default
implementation must be provided that performs the functions described in the
NavigationHandler
class description.
NavigationHandler
implementation is declared in the application
configuration resources by giving the fully qualified class name as the value of the
<navigation-handler>
element within the <application>
element.The runtime must employ the decorator pattern as for every other pluggable artifact in Jakarta Server Faces.
public abstract void setNavigationHandler(NavigationHandler handler)
Set the NavigationHandler
instance that will be passed the outcome returned by any
invoked application action for this web application.
handler
- The new NavigationHandler
instancejava.lang.NullPointerException
- if handler
is null
public ResourceHandler getResourceHandler()
Return the singleton, stateless, thread-safe ResourceHandler
for this application.
The Jakarta Server Faces implementation must support the following techniques for declaring an alternate
implementation of ResourceHandler
.
The ResourceHandler
implementation is declared in the application configuration
resources by giving the fully qualified class name as the value of the
<resource-handler>
element within the <application>
element.
In all of the above cases, the runtime must employ the decorator pattern as for every other pluggable artifact in Jakarta Server Faces.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function
public void setResourceHandler(ResourceHandler resourceHandler)
Set the ResourceHandler
instance that will be utilized for rendering the markup for
resources, and for satisfying client requests to serve up resources.
resourceHandler
- The new ResourceHandler
instancejava.lang.IllegalStateException
- if this method is called after at least one request has been
processed by the Lifecycle
instance for this application.java.lang.NullPointerException
- if resourceHandler
is null
public abstract PropertyResolver getPropertyResolver()
getELResolver()
.
Return a PropertyResolver
instance that wraps the ELResolver
instance that
Faces provides to the Jakarta Expression Language for the resolution of expressions that appear
programmatically in an application.
Note that this no longer returns the default PropertyResolver
since that class
is now a no-op that aids in allowing custom PropertyResolver
s to affect the EL
resolution process.
public abstract void setPropertyResolver(PropertyResolver resolver)
<el-resolver>
element at the right place in the application
configuration resources which will be considered in the normal course of
expression evaluation. This method now will cause the argument
resolver
to be wrapped inside an implementation of
ELResolver
and exposed to the Jakarta Expression Language resolution system as if the user had
called addELResolver(javax.el.ELResolver)
.
Set the PropertyResolver
instance that will be utilized to resolve method and value
bindings.
This method is now deprecated but the implementation must cause the argument to be set as the
head of the legacy PropertyResolver
chain, replacing any existing value that was
set from the application configuration resources.
It is illegal to call this method after the application has received any requests from the client. If an attempt is made to register a listener after that time it must have no effect.
resolver
- The new PropertyResolver
instancejava.lang.NullPointerException
- if resolver
is null
java.lang.IllegalStateException
- if called after the first request to the
FacesServlet
has been serviced.public java.util.ResourceBundle getResourceBundle(FacesContext ctx, java.lang.String name)
Find a ResourceBundle
as defined in the application configuration resources
under the specified name. If a ResourceBundle
was defined for the name, return
an instance that uses the locale of the current UIViewRoot
.
The default implementation throws UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend this class.
ctx
- the Faces context.name
- the name of the resource bundle.FacesException
- if a bundle was defined, but not resolvablejava.lang.NullPointerException
- if ctx == null || name == nullpublic ProjectStage getProjectStage()
Return the project stage for the currently running application instance. The default value is
ProjectStage.Production
The implementation of this method must perform the following algorithm or an equivalent with the same end result to determine the value to return.
If the value has already been determined by a previous call to this method, simply return that value.
Look for a
JNDI
environment entry under the key given by the value ofProjectStage.PROJECT_STAGE_JNDI_NAME
(return type ofjava.lang.String
). If found, continue with the algorithm below, otherwise, look for an entry in theinitParamMap
of theExternalContext
from the currentFacesContext
with the key given by the value ofProjectStage.PROJECT_STAGE_PARAM_NAME
If a value is found, see if an enum constant can be obtained by calling
ProjectStage.valueOf()
, passing the value from theinitParamMap
. If this succeeds without exception, save the value and return it.If not found, or any of the previous attempts to discover the enum constant value have failed, log a descriptive error message, assign the value as
ProjectStage.Production
and return it.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function
public abstract VariableResolver getVariableResolver()
getELResolver()
.
Return the VariableResolver
that wraps the ELResolver
instance that Faces
provides to the Jakarta Expression Language for the resolution of expressions that appear programmatically in
an application. The implementation of the VariableResolver
must pass
null
as the base argument for any methods invoked on the underlying
ELResolver
.
Note that this method no longer returns the default VariableResolver
, since that
class now is a no-op that aids in allowing custom VariableResolver
s to affect
the Jakarta Expression Language resolution process.
public abstract void setVariableResolver(VariableResolver resolver)
<el-resolver>
element at the
right place in the application configuration resources which will be considered
in the normal course of expression evaluation. This method now will cause the
argument resolver
to be wrapped inside an implementation of
ELResolver
and exposed to the Jakarta Expression Language resolution system as if the user had
called addELResolver(javax.el.ELResolver)
.
Set the VariableResolver
instance that will be consulted to resolve method and value
bindings.
This method is now deprecated but the implementation must cause the argument to be set as the
head of the legacy VariableResolver
chain, replacing any existing value that was
set from the application configuration resources.
It is illegal to call this method after the application has received any requests from the client. If an attempt is made to register a listener after that time it must have no effect.
resolver
- The new VariableResolver
instancejava.lang.NullPointerException
- if resolver
is null
java.lang.IllegalStateException
- if called after the first request to the
FacesServlet
has been serviced.public void addELResolver(ELResolver resolver)
Cause an the argument resolver
to be added to the resolver chain as specified in section JSF.5.5.1 of the Jakarta Server Faces
Specification.
It is not possible to remove an ELResolver
registered with this method, once it
has been registered.
It is illegal to register an ELResolver
after the application has received any
requests from the client. If an attempt is made to register a listener after that time, an
IllegalStateException
must be thrown. This restriction is in place to allow the
Jakarta Server Pages container to optimize for the common case where no additional ELResolver
s
are in the chain, aside from the standard ones. It is permissible to add
ELResolver
s before or after initialization to a CompositeELResolver
that is already in the chain.
The default implementation throws UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend Application
.
resolver
- the Jakarta Expression Language resolver to add.java.lang.IllegalStateException
- if called after the
first request to the FacesServlet
has been
serviced.public ELResolver getELResolver()
Return the singleton ELResolver
instance to be used for all Jakarta Expression Language resolution. This is
actually an instance of CompositeELResolver
that must contain the following
ELResolver
instances in the following order:
ELResolver
instances declared using the <el-resolver> element in the
application configuration resources.
An implementation
that wraps the head of the legacy
VariableResolver
chain, as per section VariableResolver ChainWrapper in
Chapter JSF.5 in the spec document.
An implementation
that wraps the head of the legacy
PropertyResolver
chain, as per section PropertyResolver ChainWrapper in
Chapter JSF.5 in the spec document.
Any ELResolver
instances added by calls to addELResolver(javax.el.ELResolver)
.
The default implementation throws UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend Application
.
public FlowHandler getFlowHandler()
Return the thread-safe singleton FlowHandler
for this application. For
implementations declaring compliance with version 2.2 of the specification, this method must
never return null
, even if the application has no flows. This is necessary to enable
dynamic flow creation during the application's lifetime.
All implementations that declare compliance with version 2.2 of the specification must
implement this method. For the purpose of backward compatibility with environments that
extend Application
but do not override this method, an implementation is provided that returns
null
. Due to the decoratable nature of Application
, code calling this method
should always check for a null
return.
public void setFlowHandler(FlowHandler newHandler)
Set the FlowHandler
instance used by the NavigationHandler
to satisfy the
requirements of the faces flows feature.
newHandler
- the flow handler to set.java.lang.NullPointerException
- if newHandler is null
java.lang.IllegalStateException
- if this method is called after at least one request has been
processed by the Lifecycle
instance for this application.public abstract ViewHandler getViewHandler()
Return the ViewHandler
instance that will be utilized during the Restore
View and Render Response phases of the request processing lifecycle. If not
explicitly set, a default implementation must be provided that performs the functions
described in the ViewHandler
description in the JJakarta Server Faces Specification.
public abstract void setViewHandler(ViewHandler handler)
Set the ViewHandler
instance that will be utilized during the Restore View
and Render Response phases of the request processing lifecycle.
handler
- The new ViewHandler
instancejava.lang.IllegalStateException
- if this method is called after at least one request has been
processed by the Lifecycle
instance for this application.java.lang.NullPointerException
- if handler
is null
public abstract StateManager getStateManager()
Return the StateManager
instance that will be utilized during the Restore
View and Render Response phases of the request processing lifecycle. If not
explicitly set, a default implementation must be provided that performs the functions
described in the StateManager
description in the Jakarta Server Faces Specification.
public abstract void setStateManager(StateManager manager)
Set the StateManager
instance that will be utilized during the Restore View
and Render Response phases of the request processing lifecycle.
manager
- The new StateManager
instancejava.lang.IllegalStateException
- if this method is called after at least one request has been
processed by the Lifecycle
instance for this application.java.lang.NullPointerException
- if manager
is null
public void addBehavior(java.lang.String behaviorId, java.lang.String behaviorClass)
Register a new mapping of behavior id to the name of
the corresponding Behavior
class. This allows subsequent calls to
createBehavior()
to serve as a factory for Behavior
instances.
behaviorId
- The behavior id to be registeredbehaviorClass
- The fully qualified class name of the corresponding Behavior
implementationjava.lang.NullPointerException
- if behaviorId
or behaviorClass
is
null
public Behavior createBehavior(java.lang.String behaviorId) throws FacesException
Instantiate and return a new Behavior
instance
of the class specified by a previous call to addBehavior()
for the specified
behavior id.
behaviorId
- The behavior id for which to create and return a new Behavior
instanceFacesException
- if the Behavior
cannot be createdjava.lang.NullPointerException
- if behaviorId
is null
public java.util.Iterator<java.lang.String> getBehaviorIds()
Return an Iterator
over the set of currently registered behavior ids for this
Application
.
public abstract void addComponent(java.lang.String componentType, java.lang.String componentClass)
Register a new mapping of component type to the name of the corresponding UIComponent
class. This allows subsequent calls to createComponent()
to serve as a factory
for UIComponent
instances.
componentType
- The component type to be registeredcomponentClass
- The fully qualified class name of the corresponding UIComponent
implementationjava.lang.NullPointerException
- if componentType
or componentClass
is
null
public abstract UIComponent createComponent(java.lang.String componentType) throws FacesException
Instantiate and return a new UIComponent
instance of the class specified by a previous call to addComponent()
for the
specified component type.
Before the component instance is returned, it must be inspected for the presence of a
ListenerFor
(or ListenersFor
) or
ResourceDependency
(or ResourceDependencies
) annotation. If any of these
annotations are present, the action listed in ListenerFor
or
ResourceDependency
must be taken on the component, before it is returned from this
method. This variant of createComponent
must not inspect the
Renderer
for the component to be returned for any of the afore
mentioned annotations. Such inspection is the province of
createComponent(ValueExpression, FacesContext, String, String)
or
createComponent(FacesContext, String, String)
.
componentType
- The component type for which to create and return a new
UIComponent
instanceFacesException
- if a UIComponent
of the specified type cannot be createdjava.lang.NullPointerException
- if componentType
is null
public abstract UIComponent createComponent(ValueBinding componentBinding, FacesContext context, java.lang.String componentType) throws FacesException
createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String)
.
Wrap the argument componentBinding
in an implementation of
ValueExpression
and call through to
createComponent(javax.el.ValueExpression,javax.faces.context.FacesContext,java.lang.String)
.
componentBinding
- ValueBinding
representing a component value binding
expression (typically specified by the component
attribute of a
custom tag)context
- FacesContext
for the current requestcomponentType
- Component type to create if the ValueBinding
does not return a
component instanceFacesException
- if a UIComponent
cannot be createdjava.lang.NullPointerException
- if any parameter is null
public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, java.lang.String componentType) throws FacesException
Call the getValue()
method on the
specified ValueExpression
. If it returns a UIComponent
instance, return it as
the value of this method. If it does not, instantiate a new UIComponent
instance of
the specified component type, pass the new component to the setValue()
method of
the specified ValueExpression
, and return it.
Before the component instance is returned, it must be inspected for the presence of a
ListenerFor
(or ListenersFor
) or
ResourceDependency
(or ResourceDependencies
) annotation. If any of these
annotations are present, the action listed in ListenerFor
or
ResourceDependency
must be taken on the component, before it is returned from this
method. This variant of createComponent
must not inspect the
Renderer
for the component to be returned for any of the afore
mentioned annotations. Such inspection is the province of
createComponent(ValueExpression, FacesContext, String, String)
or
createComponent(FacesContext, String, String)
.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function.
componentExpression
- ValueExpression
representing a component value expression
(typically specified by the component
attribute of a custom tag)context
- FacesContext
for the current requestcomponentType
- Component type to create if the ValueExpression
does not return
a component instanceFacesException
- if a UIComponent
cannot be createdjava.lang.NullPointerException
- if any parameter is null
public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, java.lang.String componentType, java.lang.String rendererType)
Like createComponent(ValueExpression, FacesContext, String)
except the
Renderer
for the component to be returned must be inspected for the annotations
mentioned in createComponent(ValueExpression, FacesContext, String)
as specified in
the documentation for that method. The Renderer
instance to inspect must be
obtained by calling FacesContext.getRenderKit()
and calling
RenderKit.getRenderer(java.lang.String, java.lang.String)
on the result, passing the argument
componentType
as the first argument and the result of calling
UIComponent.getFamily()
on the newly created component as the second argument. If no
such Renderer
can be found, a message must be logged with a helpful error
message. Otherwise, UIComponent.setRendererType(java.lang.String)
must be called on the newly created
UIComponent
instance, passing the argument rendererType
as the
argument.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function.
componentExpression
- ValueExpression
representing a component value expression
(typically specified by the component
attribute of a custom tag)context
- FacesContext
for the current requestcomponentType
- Component type to create if the ValueExpression
does not return
a component instancerendererType
- The renderer-type of the Renderer
that will render this
component. A null
value must be accepted for this parameter.FacesException
- if a UIComponent
cannot be createdjava.lang.NullPointerException
- if any of the parameters componentExpression
,
context
, or componentType
are null
public UIComponent createComponent(FacesContext context, java.lang.String componentType, java.lang.String rendererType)
Like createComponent(String)
except the Renderer
for the component to
be returned must be inspected for the annotations mentioned in
createComponent(ValueExpression, FacesContext, String)
as specified in the
documentation for that method. The Renderer
instance to inspect must be obtained
by calling FacesContext.getRenderKit()
and calling
RenderKit.getRenderer(java.lang.String, java.lang.String)
on the result, passing the argument
componentType
as the first argument and the result of calling
UIComponent.getFamily()
on the newly created component as the second argument. If no
such Renderer
can be found, a message must be logged with a helpful error
message. Otherwise, UIComponent.setRendererType(java.lang.String)
must be called on the newly created
UIComponent
instance, passing the argument rendererType
as the
argument.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function
context
- FacesContext
for the current requestcomponentType
- Component type to createrendererType
- The renderer-type of the Renderer
that will render this
component. A null
value must be accepted for this parameter.FacesException
- if a UIComponent
cannot be createdjava.lang.NullPointerException
- if any of the parameters context
, or
componentType
are null
public UIComponent createComponent(FacesContext context, Resource componentResource)
Instantiate and return a new
UIComponent
instance from the argument Resource
. An algorithm semantically
equivalent to the following must be followed to instantiate the UIComponent
to
return.
Obtain a reference to the ViewDeclarationLanguage
for this Application
instance by calling ViewHandler.getViewDeclarationLanguage(javax.faces.context.FacesContext, java.lang.String)
, passing the
viewId
found by calling UIViewRoot.getViewId()
on
the UIViewRoot
in the argument FacesContext
.
Obtain a reference to the composite component metadata for this composite component
by calling ViewDeclarationLanguage.getComponentMetadata(javax.faces.context.FacesContext, javax.faces.application.Resource)
, passing the
facesContext
and componentResource
arguments to this method. This
version of the Jakarta Server Faces specification uses JavaBeans as the API to the component metadata.
Determine if the component author declared a componentType
for this component instance by
obtaining the BeanDescriptor
from the component metadata and calling its
getValue()
method, passing UIComponent.COMPOSITE_COMPONENT_TYPE_KEY
as
the argument. If non-null
, the result must be a ValueExpression
whose value is the component-type
of the UIComponent
to be created
for this Resource
component. Call through to
createComponent(java.lang.String)
to create the component.
Otherwise, determine if a script based component for this Resource
can be found
by calling ViewDeclarationLanguage.getScriptComponentResource(javax.faces.context.FacesContext, javax.faces.application.Resource)
. If the result is
non-null
, and is a script written in one of the languages listed in JSF.4.3 of
the specification prose document, create a UIComponent
instance from the script
resource.
Otherwise, let library-name be the return from calling
Resource.getLibraryName()
on the argument componentResource
and
resource-name be the return from calling Resource.getResourceName()
on the
argument componentResource
. Create a fully qualified Java class name by removing
any file extension from resource-name and let fqcn be
library-name + "." +
resource-name
. If a class with the name of fqcn cannot be found, take
no action and continue to the next step. If any of InstantiationException
,
IllegalAccessException
, or ClassCastException
are thrown, wrap the
exception in a FacesException
and re-throw it. If any other exception is thrown,
log the exception and continue to the next step.
If none of the previous steps have yielded a UIComponent
instance, call
createComponent(java.lang.String)
passing "javax.faces.NamingContainer
"
as the argument.
Call UIComponent.setRendererType(java.lang.String)
on the UIComponent
instance, passing
"javax.faces.Composite
" as the argument.
Store the argument Resource
in the attributes Map
of the
UIComponent
under the key, Resource.COMPONENT_RESOURCE_KEY
.
Store composite component metadata in the attributes Map
of the
UIComponent
under the key, UIComponent.BEANINFO_KEY
.
Before the component instance is returned, it must be inspected for the presence of a
ListenerFor
annotation. If this annotation is present, the action
listed in ListenerFor
must be taken on the component, before it is
returned from this method.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function.
context
- FacesContext
for the current requestcomponentResource
- A Resource
that points to a source file that provides an
implementation of a component.FacesException
- if a UIComponent
from the Resource
cannot be createdjava.lang.NullPointerException
- if any parameter is null
java.lang.NullPointerException
- if unable, for any reason, to obtain a
ViewDeclarationLanguage
instance as described above.public abstract java.util.Iterator<java.lang.String> getComponentTypes()
Return an Iterator
over the set of currently defined component types for this
Application
.
public abstract void addConverter(java.lang.String converterId, java.lang.String converterClass)
Register a new mapping of converter id to the name of the corresponding Converter
class. This allows subsequent calls to createConverter()
to serve as a factory
for Converter
instances.
converterId
- The converter id to be registeredconverterClass
- The fully qualified class name of the corresponding Converter
implementationjava.lang.NullPointerException
- if converterId
or converterClass
is
null
public abstract void addConverter(java.lang.Class<?> targetClass, java.lang.String converterClass)
Register a new converter class that is capable of performing conversions for the specified target class.
targetClass
- The class for which this converter is registeredconverterClass
- The fully qualified class name of the corresponding Converter
implementationjava.lang.NullPointerException
- if targetClass
or converterClass
is
null
public abstract Converter createConverter(java.lang.String converterId)
Instantiate and return a new Converter
instance of the class specified by a previous call to addConverter()
for the
specified converter id.
If the toLowerCase()
of the String
represenation of the value of
the "javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE
"
application configuration parameter is "true
" (without the quotes) and the
Converter
instance to be returned is an instance of
DateTimeConverter
,
DateTimeConverter.setTimeZone(java.util.TimeZone)
must be called, passing the return
from TimeZone.getDefault()
.
The argument converter
must be inspected for the presence of the
ResourceDependency
annotation. If the
ResourceDependency
annotation is present, the action described in
ResourceDependency
must be taken. If the ResourceDependency
annotation is not present, the argument converter
must be inspected for the
presence of the ResourceDependencies
annotation. If the
ResourceDependencies
annotation is present, the action described in
ResourceDependencies
must be taken.
converterId
- The converter id for which to create and return a new Converter
instanceFacesException
- if the Converter
cannot be createdjava.lang.NullPointerException
- if converterId
is null
public abstract Converter createConverter(java.lang.Class<?> targetClass)
Instantiate and return a new Converter
instance of the class that has registered itself as capable of performing conversions for
objects of the specified type. If no such Converter
class can be identified, return
null
.
To locate an appropriate Converter
class, the following algorithm is performed,
stopping as soon as an appropriate Converter
class is found:
Converter
registered for the target class itself.Converter
registered for interfaces that are implemented by the target
class (directly or indirectly).Converter
registered for the superclass (if any) of the target class,
recursively working up the inheritance hierarchy.
If the Converter
has a single argument constructor that accepts a
Class
, instantiate the Converter
using that constructor, passing
the argument targetClass
as the sole argument. Otherwise, simply use the
zero-argument constructor.
If the toLowerCase()
of the String
represenation of the value of
the "javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE
"
application configuration parameter is "true
" (without the quotes) and the
Converter
instance to be returned is an instance of
DateTimeConverter
,
DateTimeConverter.setTimeZone(java.util.TimeZone)
must be called, passing the return
from TimeZone.getDefault()
.
targetClass
- Target class for which to return a Converter
FacesException
- if the Converter
cannot be createdjava.lang.NullPointerException
- if targetClass
is null
public abstract java.util.Iterator<java.lang.String> getConverterIds()
Return an Iterator
over the set of currently registered converter ids for this
Application
.
public abstract java.util.Iterator<java.lang.Class<?>> getConverterTypes()
Return an Iterator
over the set of Class
instances for which
Converter
classes have been explicitly registered.
public void addDefaultValidatorId(java.lang.String validatorId)
Register a validator by its id that is applied to all UIInput
components in a
view. The validator to most often serve this role is the BeanValidator
. The
usage contract for this method assumes that the validator has been registered using the
normal “by-id” registration mechanism.
An implementation is provided that takes no action so that users that decorate the
Application
continue to work.
validatorId
- the validator id.public java.util.Map<java.lang.String,java.lang.String> getDefaultValidatorInfo()
Return an immutable Map
over the set of currently registered default validator
IDs and their class name for this Application
.
An implementation is provided that returns Collections.emptyMap
so that users
that decorate the Application
continue to work.
public ExpressionFactory getExpressionFactory()
Return the ExpressionFactory
instance for this application. This instance is used by
the convenience method evaluateExpressionGet(javax.faces.context.FacesContext, java.lang.String, java.lang.Class<? extends T>)
.
The implementation must return the ExpressionFactory
from the Jakarta Server Pages container by
calling
JspFactory.getDefaultFactory().getJspApplicationContext(servletContext).getExpressionFactory()
.
An implementation is provided that throws UnsupportedOperationException
so that
users that decorate the Application
continue to work.
public <T> T evaluateExpressionGet(FacesContext context, java.lang.String expression, java.lang.Class<? extends T> expectedType) throws ELException
Get a value by evaluating an expression.
Call getExpressionFactory()
then call ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>)
passing the argument expression
and expectedType
. Call
FacesContext.getELContext()
and pass it to ValueExpression.getValue(javax.el.ELContext)
, returning
the result.
An implementation is provided that throws UnsupportedOperationException
so that
users that decorate the Application
continue to work.
T
- the return type.context
- the Faces context.expression
- the expression.expectedType
- the expected type.ELException
public abstract MethodBinding createMethodBinding(java.lang.String ref, java.lang.Class<?>[] params) throws ReferenceSyntaxException
getExpressionFactory()
then
ExpressionFactory.createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[])
.
Call getExpressionFactory()
then call
ExpressionFactory.createMethodExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>, java.lang.Class<?>[])
, passing the given arguments, and wrap the
result in a MethodBinding
implementation, returning it.
ref
- Method binding expression for which to return a MethodBinding
instanceparams
- Parameter signatures that must be compatible with those of the method to be
invoked, or a zero-length array or null
for a method that takes no
parametersjava.lang.NullPointerException
- if ref
is null
ReferenceSyntaxException
- if the specified ref
has invalid syntaxpublic abstract java.util.Iterator<java.util.Locale> getSupportedLocales()
Return an Iterator
over the supported Locale
s for this appication.
public abstract void setSupportedLocales(java.util.Collection<java.util.Locale> locales)
Set the Locale
instances representing the supported Locale
s for
this application.
locales
- The set of supported Locale
s for this applicationjava.lang.NullPointerException
- if the argument newLocales
is null
.public void addELContextListener(ELContextListener listener)
Provide a way for Faces applications to register an ELContextListener
that will
be notified on creation of ELContext
instances. This listener will be called
once per request.
An implementation is provided that throws UnsupportedOperationException
so that
users that decorate the Application
continue to work.
listener
- the Jakarta Expression Language context listener to add.public void removeELContextListener(ELContextListener listener)
Remove the argument listener
from the list of ELContextListener
s. If
listener
is null, no exception is thrown and no action is performed. If
listener
is not in the list, no exception is thrown and no action is performed.
An implementation is provided that throws UnsupportedOperationException
so that
users that decorate the Application
continue to work.
listener
- the Jakarta Expression Language context listener to remove.public ELContextListener[] getELContextListeners()
If no calls have been made to addELContextListener(javax.el.ELContextListener)
, this method must return an empty
array.
Otherwise, return an array representing the list of listeners added by calls to
addELContextListener(javax.el.ELContextListener)
.
An implementation is provided that throws UnsupportedOperationException
so that
users that decorate the Application
continue to work.
public abstract void addValidator(java.lang.String validatorId, java.lang.String validatorClass)
Register a new mapping of validator id to the name of the corresponding Validator
class. This allows subsequent calls to createValidator()
to serve as a factory
for Validator
instances.
validatorId
- The validator id to be registeredvalidatorClass
- The fully qualified class name of the corresponding Validator
implementationjava.lang.NullPointerException
- if validatorId
or validatorClass
is
null
public abstract Validator createValidator(java.lang.String validatorId) throws FacesException
Instantiate and return a new Validator
instance of the class specified by a previous call to addValidator()
for the
specified validator id.
The argument validator
must be inspected for the presence of the
ResourceDependency
annotation. If the
ResourceDependency
annotation is present, the action described in
ResourceDependency
must be taken. If the ResourceDependency
annotation is not present, the argument validator
must be inspected for the
presence of the ResourceDependencies
annotation. If the
ResourceDependencies
annotation is present, the action described in
ResourceDependencies
must be taken.
validatorId
- The validator id for which to create and return a new Validator
instanceFacesException
- if a Validator
of the specified id cannot be createdjava.lang.NullPointerException
- if validatorId
is null
public abstract java.util.Iterator<java.lang.String> getValidatorIds()
Return an Iterator
over the set of currently registered validator ids for this
Application
.
public abstract ValueBinding createValueBinding(java.lang.String ref) throws ReferenceSyntaxException
getExpressionFactory()
then
ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>)
.
Call getExpressionFactory()
then call ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class<?>)
,
passing the argument ref
, Object.class
for the expectedType, and
null
, for the fnMapper.
ref
- Value binding expression for which to return a ValueBinding
instancejava.lang.NullPointerException
- if ref
is null
ReferenceSyntaxException
- if the specified ref
has invalid syntaxpublic void publishEvent(FacesContext context, java.lang.Class<? extends SystemEvent> systemEventClass, java.lang.Object source)
If FacesContext.isProcessingEvents()
is true
and
there are one or more listeners for events of the type represented by
systemEventClass
, call those listeners, passing source
as the
source of the event. The implementation should be as fast as possible in determining whether
or not a listener for the given systemEventClass
and source
has
been installed, and should return immediately once such a determination has been made. The
implementation of publishEvent
must honor the requirements stated in
subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Class<?>, javax.faces.event.SystemEventListener)
regarding the storage and retrieval of listener instances.
Specifically, if subscribeToEvent(Class,Class,SystemEventListener)
was called, the
sourceClass
argument must match exactly the Class
of the
source
argument in the call to publishEvent()
. The implementation
must not do any inheritance hierarachy inspection when looking for a match between the
sourceClass
passed to subscribeToEvent(Class,Class,SystemEventListener)
and the sourceClass
passed to publishEvent()
in order to find any
listeners to which the event should be published. In the case where the Class
of
the source
argument does not match the Class
of the
sourceClass
used when the listener was subscribed using
subscribeToEvent()
, publishEvent(FacesContext,Class,Class,Object)
can
be used to provide the Class
used to perform the listener lookup and match.
The default implementation must implement an algorithm semantically equivalent to the following to locate listener instances and to invoke them.
If the source
argument implements
SystemEventListenerHolder
, call
SystemEventListenerHolder.getListenersForEventClass(java.lang.Class<? extends javax.faces.event.SystemEvent>)
on it, passing
the systemEventClass
argument. If the list is not empty, perform algorithm
traverseListenerList on the list.
If any view level listeners have been installed by previous calls to
subscribeToEvent(Class, Class, javax.faces.event.SystemEventListener)
on the
UIViewRoot
, perform algorithm traverseListenerList on
the list of listeners for that event installed on the UIViewRoot
.
If any Application
level listeners have been installed by previous calls to
subscribeToEvent(Class, Class, javax.faces.event.SystemEventListener)
, perform
algorithm traverseListenerList on the list.
If any Application
level listeners have been installed by previous calls to
subscribeToEvent(Class, javax.faces.event.SystemEventListener)
, perform algorithm
traverseListenerList on the list.
If the act of invoking the processListener
method causes an
AbortProcessingException
to be thrown, processing of the listeners
must be aborted, no further processing of the listeners for this event must take place, and
the exception must be logged with Level.SEVERE
.
Algorithm traverseListenerList: For each listener in the list,
Call SystemEventListener.isListenerForSource(java.lang.Object)
, passing the
source
argument. If this returns false
, take no action on the
listener.
Otherwise, if the event to be passed to the listener instances has not yet been constructed,
construct the event, passing source
as the argument to the one-argument
constructor that takes an Object
. This same event instance must be passed to all
listener instances.
Call SystemEvent.isAppropriateListener(javax.faces.event.FacesListener)
, passing the listener
instance as the argument. If this returns false
, take no action on the listener.
Call SystemEvent.processListener(javax.faces.event.FacesListener)
, passing the listener instance.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function
context
- the FacesContext
for the current requestsystemEventClass
- The Class
of event that is being published.source
- The source for the event of type systemEventClass
.java.lang.NullPointerException
- if either context
, systemEventClass
or
source
is null
public void publishEvent(FacesContext context, java.lang.Class<? extends SystemEvent> systemEventClass, java.lang.Class<?> sourceBaseType, java.lang.Object source)
This method functions exactly like publishEvent(FacesContext,Class,Object)
, except
the run-time must use the argument sourceBaseType
to find the matching listener
instead of using the Class
of the source
argument.
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function
context
- the FacesContext
for the current requestsystemEventClass
- The Class
of event that is being published.sourceBaseType
- The Class
of the source event that must be used to lookup
the listener to which this event must be published. If this argument is
null
the return from source.getClass()
must be used as
the sourceBaseType
.source
- The source for the event of type systemEventClass
.java.lang.NullPointerException
- if any arguments except for sourceBaseType
are
null
public void subscribeToEvent(java.lang.Class<? extends SystemEvent> systemEventClass, java.lang.Class<?> sourceClass, SystemEventListener listener)
Install the listener instance referenced by
argument listener
into the application as a listener for events of type
systemEventClass
that originate from objects of type sourceClass
.
If argument sourceClass
is non-null
, sourceClass
and
systemEventClass
must be used to store the argument listener
in the
application in such a way that the listener
can be quickly looked up by the
implementation of publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object)
given systemEventClass
and an instance
of the Class
referenced by sourceClass
. If argument
sourceClass
is null
, the listener
must be discoverable
by the implementation of publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object)
given only systemEventClass
.
It is valid to call this method during the processing of an event which was subscribed to by a previous call to this method.
systemEventClass
- the Class
of event for which listener
must
be fired.sourceClass
- the Class
of the instance which causes events of type
systemEventClass
to be fired. May be null
.listener
- the implementation of SystemEventListener
whose
SystemEventListener.processEvent(javax.faces.event.SystemEvent)
method must be called
when events of type systemEventClass
are fired.java.lang.NullPointerException
- if any combination of systemEventClass
, or
listener
are null
.public void subscribeToEvent(java.lang.Class<? extends SystemEvent> systemEventClass, SystemEventListener listener)
Install the listener instance referenced by
argument listener
into application as a listener for events of type
systemEventClass
. The default implementation simply calls through to
subscribeToEvent(Class, Class, javax.faces.event.SystemEventListener)
passing
null
as the sourceClass
argument
A default implementation is provided that throws UnsupportedOperationException
so that users that decorate Application
can continue to function
systemEventClass
- the Class
of event for which listener
must
be fired.listener
- the implementation of SystemEventListener
whose
SystemEventListener.processEvent(javax.faces.event.SystemEvent)
method must be called
when events of type systemEventClass
are fired.
See
subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener)
for an additional requirement regarding when it is valid to call this method.
java.lang.NullPointerException
- if any combination of systemEventClass
, or
listener
are null
.public void unsubscribeFromEvent(java.lang.Class<? extends SystemEvent> systemEventClass, java.lang.Class<?> sourceClass, SystemEventListener listener)
Remove the listener instance referenced by argument
listener
from the application as a listener for events of type
systemEventClass
that originate from objects of type sourceClass
.
See subscribeToEvent(Class, Class, javax.faces.event.SystemEventListener)
for the
specification of how the listener is stored, and therefore, how it must be removed.
See
subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener)
for an additional requirement regarding when it is valid to call this method.
systemEventClass
- the Class
of event for which listener
must
be fired.sourceClass
- the Class
of the instance which causes events of type
systemEventClass
to be fired. May be null
.listener
- the implementation of SystemEventListener
to remove
from the internal data structure.java.lang.NullPointerException
- if any combination of context
,
systemEventClass
, or listener
are null
.public void unsubscribeFromEvent(java.lang.Class<? extends SystemEvent> systemEventClass, SystemEventListener listener)
Remove the listener instance referenced by argument
listener
from the application as a listener for events of type
systemEventClass
. The default implementation simply calls through to
unsubscribeFromEvent(Class, javax.faces.event.SystemEventListener)
passing
null
as the sourceClass
argument
See
subscribeToEvent(java.lang.Class,java.lang.Class,javax.faces.event.SystemEventListener)
for an additional requirement regarding when it is valid to call this method.
systemEventClass
- the Class
of event for which listener
must
be fired.listener
- the implementation of SystemEventListener
to remove
from the internal data structure.java.lang.NullPointerException
- if any combination of context
,
systemEventClass
, or listener
are null
.public SearchExpressionHandler getSearchExpressionHandler()
Return the thread-safe singleton SearchExpressionHandler
for this application.
SearchExpressionHandler
.public void setSearchExpressionHandler(SearchExpressionHandler searchExpressionHandler)
Set the SearchExpressionHandler
instance used by the application.
searchExpressionHandler
- the SearchExpressionHandler
.java.lang.NullPointerException
- if searchExpressionHandler is null
java.lang.IllegalStateException
- if this method is called after at least one request has been
processed by the Lifecycle
instance for this application.public void addSearchKeywordResolver(SearchKeywordResolver resolver)
Cause the argument resolver
to be added to the head of the resolver chain.
It is not possible to remove a SearchKeywordResolver
registered with this method,
once it has been registered.
The default implementation throws UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend Application
.
resolver
- the SearchKeywordResolver to add.java.lang.IllegalStateException
- if called after the first request to the
FacesServlet
has been serviced.java.lang.NullPointerException
- when resolver is null.public SearchKeywordResolver getSearchKeywordResolver()
Return the singleton SearchKeywordResolver
instance to be used for all search keyword
resolution. This is actually an instance of a composite SearchKeywordResolver that must
contain the following SearchKeywordResolver
instances in the following order:
SearchKeywordResolver
instances declared using the
<search-keyword-resolver> element in the application configuration resources.
Any SearchKeywordResolver
instances added by calls to
addSearchKeywordResolver(javax.faces.component.search.SearchKeywordResolver)
.
The SearchKeywordResolver
implementations for @all
,
@child(n)
, @form
, @id(...)
,
@namingcontainer
, @next
, @none
, @parent
,
@previous
, @root
and @this
.
The default implementation throws UnsupportedOperationException
and is provided
for the sole purpose of not breaking existing applications that extend Application
.
SearchKeywordResolver
.


ctest [<options>]
The “ctest” executable is the CMake test driver program. CMake-generated build trees created for projects that use the ENABLE_TESTING and ADD_TEST commands have testing support. This program will run the tests and report results.
Choose configuration to test.
Some CMake-generated build trees can have multiple build configurations in the same tree. This option can be used to specify which one should be tested. Example configurations are “Debug” and “Release”.
Enable verbose output from tests.
Test output is normally suppressed and only summary information is displayed. This option will show all test output.
Enable more verbose output from tests.
Test output is normally suppressed and only summary information is displayed. This option will show even more test output.
Displaying more verbose internals of CTest.
This feature will result in a large number of output that is mostly useful for debugging dashboard problems.
Enable failover.
This option allows ctest to resume a test set execution that was previously interrupted. If no interruption occurred, the -F option will have no effect.
Run the tests in parallel using thegiven number of jobs.
This option tells ctest to run the tests in parallel using given number of jobs. This option can also be set by setting the environment variable CTEST_PARALLEL_LEVEL.
Make ctest quiet.
This option will suppress all the output. The output log file will still be generated if the –output-log is specified. Options such as –verbose, –extra-verbose, and –debug are ignored if –quiet is specified.
Output to log file
This option tells ctest to write all its output to a log file.
Disable actual execution of tests.
This option tells ctest to list the tests that would be run but not actually run them. Useful in conjunction with the -R and -E options.
Run tests with labels matching regular expression.
This option tells ctest to run only the tests whose labels match the given regular expression.
Run tests matching regular expression.
This option tells ctest to run only the tests whose names match the given regular expression.
Exclude tests matching regular expression.
This option tells ctest to NOT run the tests whose names match the given regular expression.
Exclude tests with labels matching regular expression.
This option tells ctest to NOT run the tests whose labels match the given regular expression.
Execute dashboard test
This option tells ctest to act as a Dart client and perform a dashboard test. All tests are <Mode><Test>, where Mode can be Experimental, Nightly, and Continuous, and Test can be Start, Update, Configure, Build, Test, Coverage, and Submit.
Define a variable for script mode
Pass in variable values on the command line. Use in conjunction with -S to pass variable values to a dashboard script. Parsing -D arguments as variable values is only attempted if the value following -D does not match any of the known dashboard types.
Sets the model for a dashboard
This option tells ctest to act as a Dart client where the TestModel can be Experimental, Nightly, and Continuous. Combining -M and -T is similar to -D
Sets the dashboard action to perform
This option tells ctest to act as a Dart client and perform some action such as start, build, test etc. Combining -M and -T is similar to -D
Specify the track to submit dashboard to
Submit dashboard to specified track instead of default one. By default, the dashboard is submitted to Nightly, Experimental, or Continuous track, but by specifying this option, the track can be arbitrary.
Execute a dashboard for a configuration
This option tells ctest to load in a configuration script which sets a number of parameters such as the binary and source directories. Then ctest will do what is required to create and run a dashboard. This option basically sets up a dashboard and then runs ctest -D with the appropriate options.
Execute a dashboard for a configuration
This option does the same operations as -S but it will do them in a separate process. This is primarily useful in cases where the script may modify the environment and you do not want the modified environment to impact other -S scripts.
Add a notes file with submission
This option tells ctest to include a notes file when submitting dashboard.
Run a specific number of tests by number.
This option causes ctest to run tests starting at number Start, ending at number End, and incrementing by Stride. Any additional numbers after Stride are considered individual test numbers. Start, End,or stride can be empty. Optionally a file can be given that contains the same syntax as the command line.
Take the Union of -I and -R
When both -R and -I are specified by default the intersection of tests are run. By specifying -U the union of tests is run instead.
Run only the tests that failed previously
This option tells ctest to perform only the tests that failed during its previous run. When this option is specified, ctest ignores all other options intended to modify the list of tests to run (-L, -R, -E, -LE, -I, etc). In the event that CTest runs and no tests fail, subsequent calls to ctest with the –rerun-failed option will run the set of tests that most recently failed (if any).
Set the max width for a test name to output
Set the maximum width for each test name to show in the output. This allows the user to widen the output to avoid clipping the test name which can be very annoying.
Set the interactive mode to 0 or 1.
This option causes ctest to run tests in either an interactive mode or a non-interactive mode. On Windows this means that in non-interactive mode, all system debug pop up windows are blocked. In dashboard mode (Experimental, Nightly, Continuous), the default is non-interactive. When just running tests not for a dashboard the default is to allow popups and interactive debugging.
Disable timing summary information for labels.
This option tells ctest not to print summary information for each label associated with the tests run. If there are no labels on the tests, nothing extra is printed.
Configure, build and run a test.
This option tells ctest to configure (i.e. run cmake on), build, and or execute a test. The configure and test steps are optional. The arguments to this command line are the source and binary directories. By default this will run CMake on the Source/Bin directories specified unless –build-nocmake is specified. The –build-generator option must be provided to use –build-and-test. If –test-command is specified then that will be run after the build is complete. Other options that affect this mode are –build-target –build-nocmake, –build-run-dir, –build-two-config, –build-exe-dir, –build-project,–build-noclean, –build-options
Specify a specific target to build.
This option goes with the –build-and-test option, if left out the all target is built.
Run the build without running cmake first.
Skip the cmake step.
Specify directory to run programs from.
Directory where programs will be after it has been compiled.
A sample executable to use to determine the configuration
A sample executable to use to determine the configuration that should be used. e.g. Debug/Release/etc
Add extra options to the build step.
This option must be the last option with the exception of –test-command
Nightly or experimental starts with next day tag.
This is useful if the build will not finish in one day.
The configuration file used to initialize CTest state when submitting dashboards.
This option tells CTest to use different initialization file instead of CTestConfiguration.tcl. This way multiple initialization files can be used for example to submit to multiple dashboards.
Overwrite CTest configuration option.
By default ctest uses configuration options from configuration file. This option will overwrite the configuration option.
Submit extra files to the dashboard.
This option will submit extra files to the dashboard.
Run child CTest instances as new processes
By default CTest will run child CTest instances within the same process. If this behavior is not desired, this argument will enforce new processes for child CTest processes.
Use a random order for scheduling tests
This option will run the tests in a random order. It is commonly used to detect implicit dependencies in a test suite.
Submit individual dashboard tests with specific index
This option allows performing the same CTest action (such as test) multiple times and submit all stages to the same dashboard (Dart2 required). Each execution requires different index.
Set a global timeout on all tests.
This option will set a global timeout on all tests that do not already have a timeout set on them.
Set a time at which all tests should stop running.
Set a real time of day at which all tests should timeout. Example: 7:00:00 -0400. Any time format understood by the curl date parser is accepted. Local time is assumed if no timezone is specified.
Submit using HTTP 1.0.
This option will force CTest to use HTTP 1.0 to submit files to the dashboard, instead of HTTP 1.1.
Do not compress test output when submitting.
This flag will turn off automatic compression of test output. Use this to maintain compatibility with an older version of CDash which doesn’t support compressed test output.
Print all available test labels.
This option will not run any tests, it will simply print the list of all labels associated with the test set.
Print usage information and exit.
Usage describes the basic command line interface and its options.
Show program name/version banner and exit.
If a file is specified, the version is written into it. The help is printed to a named <f>ile if given.
Print all help manuals and exit.
All manuals are printed in a human-readable text format. The help is printed to a named <f>ile if given.
Print one help manual and exit.
The specified manual is printed in a human-readable text format. The help is printed to a named <f>ile if given.
List help manuals available and exit.
The list contains all manuals for which help may be obtained by using the --help-manual option followed by a manual name. The help is printed to a named <f>ile if given.
Print help for one command and exit.
The cmake-commands(7) manual entry for <cmd> is printed in a human-readable text format. The help is printed to a named <f>ile if given.
List commands with help available and exit.
The list contains all commands for which help may be obtained by using the --help-command option followed by a command name. The help is printed to a named <f>ile if given.
Print cmake-commands manual and exit.
The cmake-commands(7) manual is printed in a human-readable text format. The help is printed to a named <f>ile if given.
Print help for one module and exit.
The cmake-modules(7) manual entry for <mod> is printed in a human-readable text format. The help is printed to a named <f>ile if given.
List modules with help available and exit.
The list contains all modules for which help may be obtained by using the --help-module option followed by a module name. The help is printed to a named <f>ile if given.
Print cmake-modules manual and exit.
The cmake-modules(7) manual is printed in a human-readable text format. The help is printed to a named <f>ile if given.
Print help for one policy and exit.
The cmake-policies(7) manual entry for <cmp> is printed in a human-readable text format. The help is printed to a named <f>ile if given.
List policies with help available and exit.
The list contains all policies for which help may be obtained by using the --help-policy option followed by a policy name. The help is printed to a named <f>ile if given.
Print cmake-policies manual and exit.
The cmake-policies(7) manual is printed in a human-readable text format. The help is printed to a named <f>ile if given.
Print help for one property and exit.
The cmake-properties(7) manual entries for <prop> are printed in a human-readable text format. The help is printed to a named <f>ile if given.
List properties with help available and exit.
The list contains all properties for which help may be obtained by using the --help-property option followed by a property name. The help is printed to a named <f>ile if given.
Print cmake-properties manual and exit.
The cmake-properties(7) manual is printed in a human-readable text format. The help is printed to a named <f>ile if given.
Print help for one variable and exit.
The cmake-variables(7) manual entry for <var> is printed in a human-readable text format. The help is printed to a named <f>ile if given.
List variables with help available and exit.
The list contains all variables for which help may be obtained by using the --help-variable option followed by a variable name. The help is printed to a named <f>ile if given.
Print cmake-variables manual and exit.
The cmake-variables(7) manual is printed in a human-readable text format. The help is printed to a named <f>ile if given.
The following resources are available to get help using CMake:
The primary starting point for learning about CMake.
http://www.cmake.org/Wiki/CMake_FAQ
A Wiki is provided containing answers to frequently asked questions.
http://www.cmake.org/HTML/Documentation.html
Links to available documentation may be found on this web page.
http://www.cmake.org/HTML/MailingLists.html
For help and discussion about using cmake, a mailing list is provided at<EMAIL_ADDRESS>The list is member-post-only but one may sign up on the CMake web page. Please first read the full documentation at http://www.cmake.org before posting questions to the list.


|
From Text to Concepts
|
#include <HashTable.hpp>
Public Types | |
| using | const_iterator = typename Bucket::const_iterator |
Public Member Functions | |
| HashTable () | |
| ~HashTable () | |
| double | loadFactor () const |
| size_t | size () const |
| size_t | bucketCount () const |
| size_t | autoResizeValue () const |
| Value & | operator[] (const Key &key) |
| const_iterator | find (const Key &key) const |
| void | rehash (size_t newBucketCount) |
| const_iterator | end () const |
Static Public Attributes | |
| static constexpr size_t | MAX_BUCKET_COUNT =<PHONE_NUMBER> |
| static constexpr double | LOAD_FACTOR_REHASH_THRESHOLD = 0.8 |
Class Hash table The default Hash function behind the Hash class is Fowler-Noll-Vo.
| using Concept::HashTable< Key, Value, SmallHashTableBucketCount, HashType >::const_iterator = typename Bucket::const_iterator |
The Hash table const iterator
|
inline |
Constructor
|
inline |
Destructor Delete all uckets
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Find or create the entry at key if missing
|
inline |
Extend and rehash.
|
inline |


| fct_drop {forcats} | R Documentation |
Compared to base::droplevels()
, does not drop NA
levels that have values.
fct_drop(f, only)
f |
A factor (or character vector). |
only |
A character vector restricting the set of levels to be dropped. If supplied, only levels that have no entries and appear in this vector will be removed. |
fct_expand()
to add additional levels to a factor.
f <- factor(c("a", "b"), levels = c("a", "b", "c")) f fct_drop(f) # Set only to restrict which levels to drop fct_drop(f, only = "a") fct_drop(f, only = "c")


Monitoring a Voyager Server
Voyager Server can expose a variety of useful metrics that can be consumed and visualised by the Mobile Metrics service. (Prometheus for data collection and Grafana for Visualisation).
The @aerogear/voyager-metrics
module can be used to mount a metrics middleware, exposing a metrics endpoint that can be consumed by prometheus (default: /metrics
).
Enabling Metrics in Voyager Server
-
Import the
@aerogear/voyager-metrics
module.const metrics = require('@aerogear/voyager-metrics')
-
Apply the metrics middleware to your Express app. This will expose metrics at the given endpoint.
const app = express() metrics.applyMetricsMiddlewares(app, { path: '/metrics' })
-
Inject the metrics module into Voyager Server. This will ensure metrics at the GraphQL level can be exposed.
const voyagerConfig = { metrics } const server = VoyagerServer(apolloConfig, voyagerConfig)
The Metrics Example Server Guide has an example server based off the instructions above and shows all of the steps needed to get it running.
Monitoring a Voyager Server Application
-
You have provisioned the Mobile Metrics service.
-
You have provisioned your Data Sync service.
-
You have enabled metrics in Voyager Server.
| The Mobile Metrics Service and your Voyager Server application must be provisioned in the same OpenShift project to access data. |
Overview
As there can be multiple Voyager Server applications in a namespace, Voyager Server application provisioning procedure creates a new Grafana dashboard for the Voyager Server application that is being provisioned.
After the Mobile Metrics Service (includes Grafana for visualization and the Prometheus monitoring system) and your Voyager Server application are provisioned, you should be able to see the "Data Sync Metrics - <your app name>" in the list of available dashboards (navigate to Grafana’s exposed URL → Log in → Home → Select Data Sync Metrics - <your app name>).
Dashboard panel descriptions
The Data Sync dashboard consists of several panels which give you an overview of the specific events and resources, such as memory usage, CPU usage, resolved operation count etc.
The dashboard is separated into 2 section. "Client" section shows some basic metrics about the clients and users and the "Server" secion shows some metrics about the server status.
Below you will find a detailed description of each panel and its values.
Singlestat panels show you the main summary of a single data series.
-
CPU Usage: CPU usage percentage of the Voyager Server application used currently.
-
Memory Usage: The amount of memory currently used by the Voyager Server application.
Used to show how certain values change over time, e.g. the number of operations resolved.
-
Unique Clients Over Time: Overview of the number of unique clients over the selected time range. Note that a "client" is a an application installation on a device. The client id is reset when the application is reinstalled on the same device.
-
Unique Users Over Time: Overview of the number of unique users over the selected time range. Note that a "user" is a user who is authenticated with the Identity Management.
-
Memory Usage in Time: The amount of memory used by the Voyager Server application over time.
-
CPU Usage in Time: The percentage of CPU used by the Voyager Server application over time.
-
Queries/Mutations Resolved: Overview of the resolved queries and mutations over time.
-
Resolver Timings: Overview of the how long it took to resolve operations over time.
-
Server Response Time: Overview of the how long it took the server to respond the requests.
-
Operations vs Conflicts: Overview of the resolver executions and the conflicts happened.
-
Conflicts Over Time per Operation: Overview of the conflicts and what operation caused them.


I have a strong passion for design, whether it be front-end or back-end, my goal is to deliver something that is both functional and beautiful.
I am a creative and business-savvy developer with experience across a broad range of technologies. I have a proven ability to meet strict deadlines while combining vision, ingenuity, and business acumen with well-developed skills in Azure Cloud Services, Transact SQL, Xamarin, ASP.NET, Angular, and VueJS.
Html, Javascript, Css, Typescript, Angular,
VueJS, ChartJS, jQuery, Ajax
Visual Studio Code, Figma, Github, Bootstrap,
Material Design, Git
C#, .NET Classic, .NET Core, SQL, Python,
Swift, Xamarin, IIS, LDAP
Visual Studio, SSMS, Tableau, Devops,
Process Automation, Azure, XCode, TFS


LOCAL port forwarding
Can be used for bypassing egress connection fw rules.
We need remote sshd proxyfying server which listens on fw allowed port.
Command
Executed on machine in network with firewalled egress connection
ssh <user@sshd_server> -p <sshd_port> -L <local_port>:<remote_webserver>:<remote_webserver_port>


| This is just a really long news article headline that will link to the article itself |
Save |
| This is just a really long news article headline that will link to the article itself |
Save |
| This is just a really long news article headline that will link to the article itself |
Save |


Quick Ways to Enhance Enjoyment and Create a Personal Connection to Online Students: presented webinar for National Distance Learning Week (NDLW), November 12, 2021.
EdPuzzle with Professor Shloming offered by the Office of Online Learning and Academic Technologies at the Fashion Institute of Technology, Session 2: September 29, 2022; Session 1: September 28, 2022.
How to use Loom to create videos with Professor Shloming: offered by the Office of Online Learning and Academic Technologies at the Fashion Institute of Technology, Session 2: May 13, 2022; Session 1: April 22, 2022.
Adding Some Spark to Your Course Site: on demand session at the International Conference on Technology in Collegiate Mathematics (ICTCM), March 2022.
Adobe Spark Pages with Professor Shloming offered by the Office of Online Learning and Academic Technologies at the Fashion Institute of Technology, Session 2: November 18, 2021; Session 1: November 16, 2021.
Adding Spark to Your LMS: presented webinar for National Distance Learning Week (NDLW), November 12, 2021.
Simultaneously Sharing Your Screen and Face (Synchronous & Asynchronous) - on demand, virtual session at the International Conference on Technology in Collegiate Mathematics (ICTCM), March 2021.
Share Your Screen and Your Face Too!: presented webinar for National Distance Learning Week (NDLW), November 9, 2020.
Liberal Arts Computing Curricula: Innovations, Challenges, and Opportunities - Computational Literacy for Non-traditional Students - at the 51st Special Interest Group on Computer Science Education (SIGCSE) conference, Portland, OR. Accepted to facilitate a roundtable with colleagues (including Dr. Maria Hwang and Dr. Calvin Williamson), March 2020.
How to use Google Slides with Videos to Create a Captivating Presentation (co-presented with Calvin Williamson): at a Faculty-to-Faculty workshop at the Fashion Institute of Technology, May 2018.
Graphplosion - Simple Graphs for Algebra (invited to present with Calvin Williamson): will be at the International Conference on Technology in Collegiate Mathematics (ICTCM), Chicago, IL, March 2017
Online Office Hours and Collaborating with FIT Google: presented at a Faculty-to-Faculty workshop at the Fashion Institute of Technology, December 2015
Rapid Creation of Graphs for Algebra - Jazz Up Your Course (invited to present with Calvin Williamson): at the Conference of the American Mathematical Association of Two Year Colleges (AMATYC), New Orleans, LA, November 2015
Mobile First Math Content using Mathplosion (co-presented with Calvin Williamson): given at the International Conference on Technology in Collegiate Mathematics (ICTCM), Las Vegas, NV, March 2015
Building Apps for Beginners with App Inventor (co-presented with Calvin Williamson): at a Faculty-to-Faculty workshop at the Fashion Institute of Technology, February 2015
Driving Your Online Mathematics Course Using Google and Videos: presented at the Conference on Instruction and Technology (CIT), Cornell University, NY, May 2014
Building a Better Course: Google Drive and ANGEL: (co-presented with Calvin Williamson): given at EduTech Day, New York, NY, November 2013
Course Content with a Bang using Mathplosion (co-presented with Calvin Williamson): presented at the International Conference on Technology in Collegiate Mathematics (ICTCM), Boston, MA, March 2013
Rapid Content Generation for Algebra and Statistics (co-presented with Calvin Williamson): presented at the Conference of the American Mathematical Association of Two Year Colleges (AMATYC), Jacksonville, FL, November 2012
Utilizing Online Technology to Rapidly Generate Mathematics: presented at the Teaching Mathematics to a Digital Generation Conference (T3), Jamaica, NY, June 2012
Mathplosion: Rapid Content Generation for Mathematics (co-presented with Calvin Williamson): presented at the Conference on Instruction and Technology (CIT), Stony Brook, NY, June 2012
Creating Mathematics Content in the Cloud: presented at EduTech Day at the Fashion Institute of Technology, New York, NY, March 2012
Rapid Content Generation for Mathematics (co-presented with Calvin Williamson): presented at the Conference of the American Mathematical Association of Two Year Colleges (AMATYC), Austin, TX, November 2011
Check it outPlease feel free to read my Reflective Teaching Portfolio available as one of the samples from The Center for Excellence in Teaching at FIT.
CET Teaching with Tech websiteCo-Wrote Programming and Mobile Apps course (MA153); (Fall 2013) with Dr. Calvin Williamson
Co-Wrote Basic Mathematics course (MA080); (Fall 2017) with Dr. Lasse Savola
Wrote Graph Theory Honors course (MA301); (Fall 2020)
Wrote PreCalculus Online course (MA231 OL); (Fall 2021)
Check it out and other MA coursesBeen teaching online courses for many years and I am honored for this recognition.
Check it outI write mathematical poetry. You can find some of my FIB poems on the online journal: The Fib Review.
I create mathematical zines for fun.
Select Poems by Author Search


Cycling Safety
Current warning status:
Loading...
Testing information
Location
Initial value
Initial value
None
Result of loading geo-JSON


You must have Flash 10 installed to download this file.
Please make sure you are viewing BytescoutPDF.js samples through a local server, not just by opening the html file from folder
To run a local server:
- if you don't know how to run local server then download free Mangoose server for Windows from http://code.google.com/p/mongoose/
- copy mongoose.exe into the sample folder and run it by double-clicking. This will make this folder available as http://localhost:8080/
- then open http://localhost:8080/ in the browser and browse samples


| Daryl | Sweeney |
| Daryl | Sweeney | CEO |
| Guy | Wooten | Chief Technical Officer |
| Buffy | Weber | VP, Engineering |
| Hyacinth | Hood | Team Lead |
| Akeem | Carr | Junior Software Developer |
| id | text | price | manufactured | discontinued |
|---|---|---|---|---|
|
|
|
|
(All)
|
|
| 1 | Furniture | 4 | 8/12/1996 | false |
| 1.1 | Tables & Chairs | 123 | 8/12/1996 | false |
| 1.2 | Sofas | 213 | 8/12/1996 | true |
| 1.3 | Occasional Furniture | 42 | 8/12/1996 | false |
| 2 | Decor | 2 | 8/12/1996 | false |
| 2.1 | Bed Linen | 12 | 8/12/1996 | false |
| 2.2 | Curtains & Blinds | 1 | 8/12/1996 | true |
| 2.2.1 | Carpets | 54 | 8/12/1996 | true |


5.5. Binary Tree Traversals (WORK IN PROGRESS)¶
5.5.1. Binary Tree Traversals¶
Often we wish to process a binary tree by “visiting” each of its nodes, each time performing a specific action such as printing the contents of the node. Any process for visiting all of the nodes in some order is called a traversal. Any traversal that lists every node in the tree exactly once is called an enumeration of the tree’s nodes. Some applications do not require that the nodes be visited in any particular order as long as each node is visited precisely once. For other applications, nodes must be visited in an order that preserves some relationship.
<IP_ADDRESS>. Preorder Traversal¶
For example, we might wish to make sure that we visit any given node before we visit its children. This is called a preorder traversal.
Example 5.6.1
The preorder enumeration for the tree of Figure 5.6.1 is A B D C E G F H I.
The first node printed is the root. Then all nodes of the left subtree are printed (in preorder) before any node of the right subtree.
<IP_ADDRESS>. Postorder Traversal¶
Alternatively, we might wish to visit each node only after we visit its children (and their subtrees). For example, this would be necessary if we wish to return all nodes in the tree to free store. We would like to delete the children of a node before deleting the node itself. But to do that requires that the children’s children be deleted first, and so on. This is called a postorder traversal.
Example 5.6.2
The postorder enumeration for the tree of Figure 5.6.1 is D B G E H I F C A.
<IP_ADDRESS>. Inorder Traversal¶
An inorder traversal first visits the left child (including its entire subtree), then visits the node, and finally visits the right child (including its entire subtree). The binary search tree makes use of this traversal to print all nodes in ascending order of value.
Example 5.6.3
The inorder enumeration for the tree of Figure 5.6.1 is B D A G E C H F I.
<IP_ADDRESS>. Implementation¶
Now we will discuss some implementations for the traversals, but we
need to define a node ADT to work with.
Just as a linked list is composed of a collection of link objects, a
tree is composed of a collection of node objects.
Here is an ADT for binary tree nodes, called BinNode
.
This class will be used by some of the binary tree structures
presented later.
Member functions are provided that set or return the element value,
return a pointer to the left child,
return a pointer to the right child,
or indicate whether the node is a leaf.
interface BinNode<E> { // Binary tree node ADT
// Get and set the element value
public E value();
public void setValue(E v);
// return the children
public BinNode<E> left();
public BinNode<E> right();
// return TRUE if a leaf node, FALSE otherwise
public boolean isLeaf();
}
A traversal routine is naturally written as a recursive
function.
Its input parameter is a pointer to a node which we will call
rt
because each node can be viewed as the root of a some
subtree.
The initial call to the traversal function passes in a pointer to the
root node of the tree.
The traversal function visits rt
and its children (if any)
in the desired order.
For example, a preorder traversal specifies that rt
be
visited before its children.
This can easily be implemented as follows.
static <E> void preorder(BinNode<E> rt) {
if (rt == null) { return; } // Empty subtree - do nothing
visit(rt); // Process root node
preorder(rt.left()); // Process all nodes in left
preorder(rt.right()); // Process all nodes in right
}
Function preorder
first checks that the tree is not
empty (if it is, then the traversal is done and preorder
simply returns).
Otherwise, preorder
makes a call to visit
,
which processes the root node (i.e., prints the value or performs
whatever computation as required by the application).
Function preorder
is then called recursively on the left
subtree, which will visit all nodes in that subtree.
Finally, preorder
is called on the right subtree,
visiting all nodes in the right subtree.
Postorder and inorder traversals are similar.
They simply change the order in which the node and its children are
visited, as appropriate.


NetClient is an asynchronous factory for TCP or SSL connections.
Multiple connections to different servers can be made using the same
instance.
|
|
|
|
|
|
|
|
|
|
|
get_reconnect_attempts(self)
Get the number of reconnect attempts |
source code
|
|
|
|
set_reconnect_interval(self,
val)
Set the reconnect interval, in milliseconds |
source code
|
|
|
|
get_reconnect_interval(self)
Get the reconnect interval, in milliseconds. |
source code
|
|
|
|
set_connect_timeout(self,
val)
Set the connect timeout in milliseconds. |
source code
|
|
|
|
get_connect_timeout(self)
Returns the connect timeout in milliseconds |
source code
|
|
|
|
|
|
Inherited from ssl_support.ClientSSLSupport :
get_trust_all ,
set_trust_all
Inherited from ssl_support.SSLSupport :
get_key_store_password ,
get_key_store_path ,
get_ssl ,
get_trust_store_password ,
get_trust_store_path ,
set_key_store_password ,
set_key_store_path ,
set_ssl ,
set_trust_store_password ,
set_trust_store_path
Inherited from tcp_support.TCPSupport :
get_receive_buffer_size ,
get_reuse_address ,
get_send_buffer_size ,
get_so_linger ,
get_tcp_keep_alive ,
get_tcp_no_delay ,
get_traffic_class ,
get_use_pooled_buffers ,
set_receive_buffer_size ,
set_reuse_address ,
set_send_buffer_size ,
set_so_linger ,
set_tcp_keep_alive ,
set_tcp_no_delay ,
set_traffic_class ,
set_use_pooled_buffers
|