public class DependenciesImpl extends Object implements IDependencies, IConfigListener, IOptionsListener, IShutdownListener
defaultNonJSExtensions, excludes, nonJSExtensionsCfgPropName
Constructor and Description |
---|
DependenciesImpl(IAggregator aggregator,
long stamp) |
Modifier and Type | Method and Description |
---|---|
void |
configLoaded(IConfig config,
long sequence)
This method is called when the config is loaded/reloaded, after the
config has been modified by any registered
IConfigModifier
services. |
protected IAggregator |
getAggregator() |
List<String> |
getDelcaredDependencies(String mid)
Returns the dependencies for the specified module.
|
Iterable<String> |
getDependencyNames()
Returns an
Iterable over the module names that were scanned while building the
dependency map. |
List<String> |
getDependentFeatures(String mid)
Returns the list of dependent features for the specified module.
|
long |
getLastModified()
Returns the cumulative last-modified date of these dependencies which was
determined the last time the dependencies were created or validated.
|
List<String> |
getRequireDependencies(String mid)
Returns the list of modules specified in the dependency lists of any require calls contained
within the specified module.
|
URI |
getURI(String mid)
Returns the resource URI for the specified module id.
|
void |
optionsUpdated(IOptions options,
long sequence)
This method is called when the options are loaded/changed.
|
protected void |
processDeps(boolean validate,
boolean clean,
long sequence) |
protected void |
processDepsAsyncWorker(boolean validate,
boolean clean,
long sequence,
ConsoleService cs) |
void |
shutdown(IAggregator aggregator)
This method is called from within the aggregator's
GenericServlet.destroy() method to notify listeners that the servlet
is shutting down. |
void |
validateDeps(boolean clean)
Validates the dependency graph by scanning the directories returned by
IConfig.getPaths() and IConfig.getPackageLocations()
looking for new/changed/removed files and updating the dependency graph,
including the dependency graph last-modified timestamp, as needed. |
public DependenciesImpl(IAggregator aggregator, long stamp)
public void shutdown(IAggregator aggregator)
IShutdownListener
GenericServlet.destroy()
method to notify listeners that the servlet
is shutting down.shutdown
in interface IShutdownListener
aggregator
- The aggregator that is shutting downprotected IAggregator getAggregator()
public void validateDeps(boolean clean)
IDependencies
IConfig.getPaths()
and IConfig.getPackageLocations()
looking for new/changed/removed files and updating the dependency graph,
including the dependency graph last-modified timestamp, as needed.validateDeps
in interface IDependencies
clean
- If true, then any cached or previously calculated dependency
graph is discarded and a new graph is generated from scratch.
Use this option if file or directory last-modified dates
cannot be relied upon to accurately reflect the changed state
of the module files included in the graph.public void configLoaded(IConfig config, long sequence)
IConfigListener
IConfigModifier
services.configLoaded
in interface IConfigListener
config
- The new config object. In order to detect and react to config
changes, you can save the value returned from
IConfig.toString()
and compare it with the value
returned in subsequent configLoaded events.sequence
- The sequence number. Notifications for different listener
events (options, config, dependencies) that have the same
cause have the same sequence number. Notifications resulting
from servlet initialization have the sequence number 1. The
sequence number is incremented for subsequent event causes,
but there is no guarantee about the the values for subsequent
notifications other than that they will be increasing.public void optionsUpdated(IOptions options, long sequence)
IOptionsListener
optionsUpdated
in interface IOptionsListener
options
- The new options. Note that changes to the options may occur
in-place, using the same IOptions object with updated values,
or may result in a new object instance. This interface does not
specify which approach is used by an implementation.sequence
- The sequence number. Notifications for different listener
events (options, config, dependencies) that have the same
cause have the same sequence number. The sequence number is
incremented for subsequent event causes, but there is no
guarantee about the the values for subsequent notifications
other than that they will be increasing.public long getLastModified()
IDependencies
getLastModified
in interface IDependencies
protected void processDeps(boolean validate, boolean clean, long sequence)
protected void processDepsAsyncWorker(boolean validate, boolean clean, long sequence, ConsoleService cs) throws Exception
Exception
public List<String> getDelcaredDependencies(String mid) throws ProcessingDependenciesException
IDependencies
getDelcaredDependencies
in interface IDependencies
mid
- The module idProcessingDependenciesException
public List<String> getRequireDependencies(String mid) throws ProcessingDependenciesException
IDependencies
Note that no attempt is made to determine if the require call will ever be executed by the client by looking for dead code, etc. Any require calls that appear within the module will be used in collecting require dependencies.
getRequireDependencies
in interface IDependencies
mid
- The module idProcessingDependenciesException
public URI getURI(String mid) throws ProcessingDependenciesException
IDependencies
IDependencies.getDependencyNames()
will return a non-null value. Any other value passed for
mid
will result in a return value of null.getURI
in interface IDependencies
mid
- the module idProcessingDependenciesException
public List<String> getDependentFeatures(String mid) throws ProcessingDependenciesException
IDependencies
Note that not all feature names used in has() function calls may be
returned in this list. Only features that are used in has() function
calls who's return value is used as a boolean are included (e.g.
if (has('isIE')) {
). If the result of the has function call
is used as another type, then the feature may not be be included in the
returned list (e.g. var isIE = has('isIE');
or
if (has('isIE') < 8) {
). This is because feature values are
specified in aggregator requests as booleans, so aggregator optimizations
based on defined features may not be safely performed if the result of a
feature evaluation is used as a type other than boolean.
getDependentFeatures
in interface IDependencies
mid
- the module idProcessingDependenciesException
public Iterable<String> getDependencyNames() throws ProcessingDependenciesException
IDependencies
Iterable
over the module names that were scanned while building the
dependency map. This includes JavaScript modules as well as selected non-JavaScript modules.
Non-JavaScript modules included in the result include the following:
IDependencies.defaultNonJSExtensions
IDependencies.nonJSExtensionsCfgPropName
IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE
config property for the registered
module buildersIDependencies.getDelcaredDependencies(String)
or IDependencies.getDependentFeatures(String)
,
an empty list will be returned.getDependencyNames
in interface IDependencies
ProcessingDependenciesException
Copyright © 2011-2015 IBM. All Rights Reserved.