Class BaseCoverageProcessingNode
- All Implemented Interfaces:
CoverageProcessingNode
- Direct Known Subclasses:
ZeroImageNode
CoverageProcessingNode
.
This implementation provides convenient methods for managing sinks and source for a CoverageProcessingNode
. The getOutput()
is used to get the output of this CoverageProcessingNode
(a
CoverageProcessingException
is thrown in case something bad happens while processing
Implementors must implement the abstract method execute()
which is guaranteed to run in a critical
section where the sources and sinks for this CoverageProcessingNode
will not be touched.
- Author:
- Simone Giannecchini, GeoSolutions.
-
Constructor Summary
ConstructorsConstructorDescriptionBaseCoverageProcessingNode
(int maxSources, InternationalString name, InternationalString description) Default constructor that gives users the possibilityBaseCoverageProcessingNode
(int maxSources, Hints hints, InternationalString name, InternationalString description) Default constructor that gives users the possibilityBaseCoverageProcessingNode
(InternationalString name, InternationalString description) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a sinkCoverageProcessingNode
to the list of sinks for thisCoverageProcessingNode
.boolean
addSource
(CoverageProcessingNode source) Adds a sourceCoverageProcessingNode
to the list of sources for thisCoverageProcessingNode
.void
dispose
(boolean force) Disposes thisCoverageProcessingNode
along with all the resources it might have allocatedprotected static void
ensureNotNull
(Object source, String name) Checks whether the provided object is null or not.protected static void
ensureSourceNotNull
(Object source, String name) Checks whether the provided source object is null or not.protected abstract GridCoverage
execute()
Subclasses MUST override this method in order to do the actual processing.TheGridCoverageFactory
we will internally use for build intermediate and outputGridCoverage2D
.Retrieves the description for thisCoverageProcessingNode
getHints()
Getter forHints
.int
retrieves the maximum number of sources we are allowed to set for thisCoverageProcessingNode
getName()
Retrieves the name for thisCoverageProcessingNode
int
Returns the number of sinks for thisCoverageProcessingNode
.int
Returns the number of sources for thisCoverageProcessingNode
.This method is responsible for triggering the execution of thisCoverageProcessingNode
and also of all its sources.getSink
(int index) getSinks()
Retrieves theList
of sinks for thisCoverageProcessingNode
.getSource
(int index) Retrieves theList
of source for thisCoverageProcessingNode
.boolean
Tells me whether or not the node has been already disposed.boolean
Tells me whether or not the node has been already executed.removeSink
(int index) Removes a sinkCoverageProcessingNode
from the list of sinks for thisCoverageProcessingNode
.boolean
Removes a sinkCoverageProcessingNode
from the list of sinks for thisCoverageProcessingNode
.removeSource
(int index) Removes a sourceCoverageProcessingNode
to the list of sources for thisCoverageProcessingNode
.boolean
removeSource
(CoverageProcessingNode source) Removes a sourceCoverageProcessingNode
to the list of sources for thisCoverageProcessingNode
.toString()
Provides a descriptive description for thisCoverageProcessingNode
.
-
Constructor Details
-
BaseCoverageProcessingNode
Default constructor -
BaseCoverageProcessingNode
public BaseCoverageProcessingNode(int maxSources, InternationalString name, InternationalString description) Default constructor that gives users the possibility- Parameters:
maxSources
- maximum number of sources allowed for this node.
-
BaseCoverageProcessingNode
public BaseCoverageProcessingNode(int maxSources, Hints hints, InternationalString name, InternationalString description) Default constructor that gives users the possibility- Parameters:
maxSources
- maximum number of sources allowed for this node.hints
- instance ofHints
class to control creation of internal factories. It can benull
.
-
-
Method Details
-
execute
Subclasses MUST override this method in order to do the actual processing.Note that this method is invoked through this framework hence it is run within a critical section. Be careful with what you do within this method since it is essentially an "alien" method running within a synch section, hence all sort of bad things can happen.
- Returns:
- a
GridCoverage2D
which is the result of the processing.
-
dispose
public void dispose(boolean force) Disposes thisCoverageProcessingNode
along with all the resources it might have allocatedThe result for this
CoverageProcessingNode
is also disposed.- Specified by:
dispose
in interfaceCoverageProcessingNode
- Parameters:
force
- force the disposition of this node.
-
getOutput
This method is responsible for triggering the execution of thisCoverageProcessingNode
and also of all its sources.In case something bad happens a
CoverageProcessingException
is thrown.- Specified by:
getOutput
in interfaceCoverageProcessingNode
- Returns:
- the
Coverage
which represents the output for thisCoverageProcessingNode
. - Throws:
CoverageProcessingException
- UML property:
- name="output"
-
addSink
Description copied from interface:CoverageProcessingNode
Adds a sinkCoverageProcessingNode
to the list of sinks for thisCoverageProcessingNode
.- Specified by:
addSink
in interfaceCoverageProcessingNode
- Parameters:
sink
- theCoverageProcessingNode
to add to theList
of sinks for thisCoverageProcessingNode
.
-
addSource
Description copied from interface:CoverageProcessingNode
Adds a sourceCoverageProcessingNode
to the list of sources for thisCoverageProcessingNode
.- Specified by:
addSource
in interfaceCoverageProcessingNode
- Parameters:
source
- theCoverageProcessingNode
to add to theList
of sources for thisCoverageProcessingNode
.- Returns:
true
if everything goes fine,false
otherwise.
-
getSink
Description copied from interface:CoverageProcessingNode
- Specified by:
getSink
in interfaceCoverageProcessingNode
- Parameters:
index
- is the zero-based index for the source we want to access.- Returns:
- the
CoverageProcessingNode
which represents the source at indexindex
for thisCoverageProcessingNode
.
-
getSinks
Description copied from interface:CoverageProcessingNode
Retrieves theList
of sinks for thisCoverageProcessingNode
. Each sink MUST be aCoverageProcessingNode
.- Specified by:
getSinks
in interfaceCoverageProcessingNode
- Returns:
- a
List
ofCoverageProcessingNode
which represents the sinks for thisCoverageProcessingNode
. - UML property:
- name="sinks"
-
getSource
Description copied from interface:CoverageProcessingNode
- Specified by:
getSource
in interfaceCoverageProcessingNode
- Parameters:
index
- is the zero-based index for the sink we want to get.- Returns:
- the
CoverageProcessingNode
which represents the sink at indexindex
for thisCoverageProcessingNode
.
-
getSources
Description copied from interface:CoverageProcessingNode
Retrieves theList
of source for thisCoverageProcessingNode
. Each source MUST be aCoverageProcessingNode
.- Specified by:
getSources
in interfaceCoverageProcessingNode
- Returns:
- a
List
ofCoverageProcessingNode
which represents the sources for thisCoverageProcessingNode
. - UML property:
- name="sources"
-
removeSink
Description copied from interface:CoverageProcessingNode
Removes a sinkCoverageProcessingNode
from the list of sinks for thisCoverageProcessingNode
.- Specified by:
removeSink
in interfaceCoverageProcessingNode
- Parameters:
sink
- theCoverageProcessingNode
to remove from theList
of sinks for thisCoverageProcessingNode
.- Returns:
true
in case we remove something,false
otherwise.
-
removeSink
Description copied from interface:CoverageProcessingNode
Removes a sinkCoverageProcessingNode
from the list of sinks for thisCoverageProcessingNode
.- Specified by:
removeSink
in interfaceCoverageProcessingNode
- Parameters:
index
- the index at which we want to remove a sink from theList
of sinks for thisCoverageProcessingNode
.- Returns:
- the
CoverageProcessingNode
we actually remove from the sinks list.
-
removeSource
Description copied from interface:CoverageProcessingNode
Removes a sourceCoverageProcessingNode
to the list of sources for thisCoverageProcessingNode
.- Specified by:
removeSource
in interfaceCoverageProcessingNode
- Parameters:
source
- theCoverageProcessingNode
to remove from theList
of sources for thisCoverageProcessingNode
.- Returns:
true
in case we remove something,false
otherwise.
-
getHints
Getter forHints
.- Specified by:
getHints
in interfaceCoverageProcessingNode
- Returns:
Hints
provided at construction time to controlGridCoverageFactory
creation.- UML property:
- name="hints"
-
getMaximumNumberOfSources
public int getMaximumNumberOfSources()retrieves the maximum number of sources we are allowed to set for thisCoverageProcessingNode
- Returns:
- the maximum number of sources we are allowed to set for this
CoverageProcessingNode
- UML property:
- name="maximumNumberOfSources"
-
getCoverageFactory
TheGridCoverageFactory
we will internally use for build intermediate and outputGridCoverage2D
.- Specified by:
getCoverageFactory
in interfaceCoverageProcessingNode
- Returns:
- a
GridCoverageFactory
we will internally use for build intermediate and outputGridCoverage2D
. - UML property:
- name="coverageFactory"
-
getNumberOfSinks
public int getNumberOfSinks()Description copied from interface:CoverageProcessingNode
Returns the number of sinks for thisCoverageProcessingNode
.- Specified by:
getNumberOfSinks
in interfaceCoverageProcessingNode
- Returns:
- the number of sinks for this
CoverageProcessingNode
.
-
getNumberOfSources
public int getNumberOfSources()Description copied from interface:CoverageProcessingNode
Returns the number of sources for thisCoverageProcessingNode
.- Specified by:
getNumberOfSources
in interfaceCoverageProcessingNode
- Returns:
- the number of sources for this
CoverageProcessingNode
.
-
getDescription
Description copied from interface:CoverageProcessingNode
Retrieves the description for thisCoverageProcessingNode
- Specified by:
getDescription
in interfaceCoverageProcessingNode
- Returns:
- the description for this
CoverageProcessingNode
- UML property:
- name="description"
-
getName
Description copied from interface:CoverageProcessingNode
Retrieves the name for thisCoverageProcessingNode
- Specified by:
getName
in interfaceCoverageProcessingNode
- Returns:
- the name for this
CoverageProcessingNode
- UML property:
- name="name"
-
ensureSourceNotNull
Checks whether the provided source object is null or not. If it is null it throws anIllegalArgumentException
exception.- Parameters:
source
- the object to check.name
- the operation we are trying to run.
-
ensureNotNull
Checks whether the provided object is null or not. If it is null it throws anIllegalArgumentException
exception.- Parameters:
source
- the object to check.name
- the operation we are trying to run.
-
removeSource
Description copied from interface:CoverageProcessingNode
Removes a sourceCoverageProcessingNode
to the list of sources for thisCoverageProcessingNode
.- Specified by:
removeSource
in interfaceCoverageProcessingNode
- Parameters:
index
- the index at which we want to remove a source from theList
of sources for thisCoverageProcessingNode
.- Returns:
- the
CoverageProcessingNode
we actually remove from the sources list. - Throws:
IndexOutOfBoundsException
-
toString
Description copied from interface:CoverageProcessingNode
Provides a descriptive description for thisCoverageProcessingNode
.- Specified by:
toString
in interfaceCoverageProcessingNode
- Overrides:
toString
in classObject
- Returns:
- a descriptive description for this
CoverageProcessingNode
-
isDisposed
public boolean isDisposed()Tells me whether or not the node has been already disposed.- Returns:
true
if the node has been already disposed,false
otherwise.- UML property:
- name="disposed"
-
isExecuted
public boolean isExecuted()Tells me whether or not the node has been already executed.- Returns:
true
if the node has been already executed,false
otherwise.- UML property:
- name="executed"
-