Class BaseCoverageProcessingNode
- Object
-
- BaseCoverageProcessingNode
-
- All Implemented Interfaces:
CoverageProcessingNode
- Direct Known Subclasses:
ZeroImageNode
public abstract class BaseCoverageProcessingNode extends Object implements CoverageProcessingNode
Base implementation of aCoverageProcessingNode
.This implementation provides convenient methods for managing sinks and source for a
CoverageProcessingNode
. ThegetOutput()
is used to get the output of thisCoverageProcessingNode
(aCoverageProcessingException
is thrown in case something bad happens while processingImplementors must implement the abstract method
execute()
which is guaranteed to run in a critical section where the sources and sinks for thisCoverageProcessingNode
will not be touched.- Author:
- Simone Giannecchini, GeoSolutions.
-
-
Constructor Summary
Constructors Constructor Description BaseCoverageProcessingNode(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
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addSink(CoverageProcessingNode sink)
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.GridCoverageFactory
getCoverageFactory()
TheGridCoverageFactory
we will internally use for build intermediate and outputGridCoverage2D
.InternationalString
getDescription()
Retrieves the description for thisCoverageProcessingNode
Hints
getHints()
Getter forHints
.int
getMaximumNumberOfSources()
retrieves the maximum number of sources we are allowed to set for thisCoverageProcessingNode
InternationalString
getName()
Retrieves the name for thisCoverageProcessingNode
int
getNumberOfSinks()
Returns the number of sinks for thisCoverageProcessingNode
.int
getNumberOfSources()
Returns the number of sources for thisCoverageProcessingNode
.GridCoverage2D
getOutput()
This method is responsible for triggering the execution of thisCoverageProcessingNode
and also of all its sources.CoverageProcessingNode
getSink(int index)
List<CoverageProcessingNode>
getSinks()
Retrieves theList
of sinks for thisCoverageProcessingNode
.CoverageProcessingNode
getSource(int index)
List<CoverageProcessingNode>
getSources()
Retrieves theList
of source for thisCoverageProcessingNode
.boolean
isDisposed()
Tells me whether or not the node has been already disposed.boolean
isExecuted()
Tells me whether or not the node has been already executed.CoverageProcessingNode
removeSink(int index)
Removes a sinkCoverageProcessingNode
from the list of sinks for thisCoverageProcessingNode
.boolean
removeSink(CoverageProcessingNode sink)
Removes a sinkCoverageProcessingNode
from the list of sinks for thisCoverageProcessingNode
.CoverageProcessingNode
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
.String
toString()
Provides a descriptive description for thisCoverageProcessingNode
.
-
-
-
Constructor Detail
-
BaseCoverageProcessingNode
public BaseCoverageProcessingNode(InternationalString name, InternationalString description)
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 Detail
-
execute
protected abstract GridCoverage 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
public GridCoverage2D getOutput() throws CoverageProcessingException
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
public void addSink(CoverageProcessingNode sink)
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
public boolean addSource(CoverageProcessingNode source)
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
public CoverageProcessingNode getSink(int index)
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
public List<CoverageProcessingNode> 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
public CoverageProcessingNode getSource(int index)
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
public List<CoverageProcessingNode> 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
public boolean removeSink(CoverageProcessingNode sink)
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
public CoverageProcessingNode removeSink(int index)
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
public boolean removeSource(CoverageProcessingNode source)
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
public Hints 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
public GridCoverageFactory 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
public InternationalString 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
public InternationalString 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
protected static void ensureSourceNotNull(Object source, String name)
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
protected static void ensureNotNull(Object source, String name)
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
public CoverageProcessingNode removeSource(int index) throws IndexOutOfBoundsException
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
public String 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"
-
-