Package org.esa.snap.core.datamodel
Class ProductNode
java.lang.Object
com.bc.ceres.core.ExtensibleObject
org.esa.snap.core.datamodel.ProductNode
- All Implemented Interfaces:
Extensible
- Direct Known Subclasses:
DataNode,MetadataElement,Placemark,Product,ProductNodeGroup,Quicklook,VectorDataNode
The
ProductNode is the base class for all nodes within a remote sensing data product and even the data
product itself.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProductNode(String name) Constructs a new product node with the given name.protectedProductNode(String name, String description) Constructs a new product node with the given name and an optional description. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidacceptVisitor(ProductVisitor visitor) Accepts the given visitor.voiddispose()Releases all of the resources used by this object instance and all of its owned children.voidfireProductNodeChanged(String propertyName) voidfireProductNodeChanged(String propertyName, Object oldValue, Object newValue) Returns a short textual description for this products node.Returns this node's display name.getName()getOwner()Returns the product to which this node belongs to.Returns the product reader for the product to which this node belongs to.protected ProductReaderReturns the product reader for the product to which this node belongs to.Gets the product reference string.protected ProductReturns safely the product to which this node belongs to.Returns the product writer for the product to which this node belongs to.protected ProductWriterReturns the product writer for the product to which this node belongs to.longGets an estimated, raw storage size in bytes of this product node.abstract longgetRawStorageSize(ProductSubsetDef subsetDef) Gets an estimated, raw storage size in bytes of this product node.booleanReturns whether or not this node is modified.protected booleanisPartOfSubset(ProductSubsetDef subsetDef) Returns whether this node is part of the given subset.static booleanisValidNodeName(String name) Tests whether the given name is valid name for a node.voidremoveFromFile(ProductWriter productWriter) Physically remove this node from the file associated with the given product writer.voidsetDescription(String description) Sets a short textual description for this products node.voidsetModified(boolean modified) Sets this node's modified flag.voidSets this product's name.protected voidsetNodeName(String trimmedName, boolean silent, boolean allowSameName) Perform various checks and set the new name .voidsetOwner(ProductNode owner) Sets the owner node of this node.toString()voidupdateExpression(String oldExternalName, String newExternalName) Asks a product node to replace all occurences of and references to the node name given byoldExternalNamewitholdExternalName.Methods inherited from class com.bc.ceres.core.ExtensibleObject
getExtension
-
Field Details
-
PROPERTY_NAME_NAME
- See Also:
-
PROPERTY_NAME_DESCRIPTION
- See Also:
-
-
Constructor Details
-
ProductNode
Constructs a new product node with the given name.- Parameters:
name- the node name, must not benull- Throws:
IllegalArgumentException- if the given name is not a valid node identifier
-
ProductNode
Constructs a new product node with the given name and an optional description.- Parameters:
name- the node name, must not benulldescription- a descriptive string, can benull- Throws:
IllegalArgumentException- if the given name is not a valid node identifier
-
-
Method Details
-
setOwner
Sets the owner node of this node.Overrides shall finally call
super.setOwner(owner).- Parameters:
owner- the new owner
-
getOwner
- Returns:
- The owner node of this node.
-
getName
- Returns:
- This node's name.
-
setName
Sets this product's name.- Parameters:
name- The name.
-
setNodeName
Perform various checks and set the new name .- Parameters:
trimmedName- the namesilent- signal or not the changeallowSameName- allow the name to be identical to another item's name
-
getDescription
Returns a short textual description for this products node.- Returns:
- a description or
null
-
setDescription
Sets a short textual description for this products node.- Parameters:
description- a description, can benull
-
isModified
public boolean isModified()Returns whether or not this node is modified.- Returns:
trueif so
-
setModified
public void setModified(boolean modified) Sets this node's modified flag.If the modified flag changes to true and this node has an owner, the owner's modified flag is also set to true.
- Parameters:
modified- whether or not this node is beeing marked as modified.- See Also:
-
toString
-
dispose
public void dispose()Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to
dispose()are undefined.Overrides of this method should always call
super.dispose();after disposing this instance. -
isValidNodeName
Tests whether the given name is valid name for a node. A valid node name must not start with a dot. Also a valid node name must not contain any of the character\/:*?"<>|- Parameters:
name- the name to test- Returns:
trueif the name is a valid node identifier,falseotherwise
-
getProduct
Returns the product to which this node belongs to.- Returns:
- the product, or
nullif this node was not owned by a product at the time this method was called
-
getProductSafe
Returns safely the product to which this node belongs to.- Returns:
- the product, never
null - Throws:
IllegalStateException- if this node does not belong to a product
-
getProductReader
Returns the product reader for the product to which this node belongs to.- Returns:
- the product reader, or
nullif no such exists
-
getProductReaderSafe
Returns the product reader for the product to which this node belongs to. The method throws anIllegalStateExceptionif no such reader exists.- Returns:
- the product reader, never
null - Throws:
IllegalStateException- if the product reader isnull
-
getProductWriter
Returns the product writer for the product to which this node belongs to.- Returns:
- the product writer, or
nullif no such exists
-
getProductWriterSafe
Returns the product writer for the product to which this node belongs to. The method throws anIllegalStateExceptionif no such writer exists.- Returns:
- the product writer, never
null - Throws:
IllegalStateException- if the the product writer isnull
-
getDisplayName
Returns this node's display name. The display name is the product reference string with the node name appended.Example: The string
"[2] node-name"means nodenode-nameof the product with the reference number2.- Returns:
- this node's name with a product prefix
or this node's name only if this node's product prefix isnull - See Also:
-
getProductRefString
Gets the product reference string. The product reference string is the product reference number enclosed in square brackets.Example: The string
"[2]"stands for a product with the reference number2.- Returns:
- the product reference string.
ornullif this node has no product
ornullif its product reference number was inactive
-
getRawStorageSize
public long getRawStorageSize()Gets an estimated, raw storage size in bytes of this product node.- Returns:
- the size in bytes.
-
getRawStorageSize
Gets an estimated, raw storage size in bytes of this product node.- Parameters:
subsetDef- if notnullthe subset may limit the size returned- Returns:
- the size in bytes.
-
updateExpression
Asks a product node to replace all occurences of and references to the node name given byoldExternalNamewitholdExternalName. Such references most often occur in band arithmetic expressions.- Parameters:
oldExternalName- The old node name.newExternalName- The new node name.
-
fireProductNodeChanged
-
fireProductNodeChanged
-
acceptVisitor
Accepts the given visitor. This method implements the well known 'Visitor' design pattern of the gang-of-four. The visitor pattern allows to define new operations on the product data model without the need to add more code to it. The new operation is implemented by the visitor.- Parameters:
visitor- the visitor
-
isPartOfSubset
Returns whether this node is part of the given subset.- Parameters:
subsetDef- The subset definition.- Returns:
trueif the subset is notnulland it contains a node name equal to this node's name.
-
removeFromFile
Physically remove this node from the file associated with the given product writer. The default implementation does nothing.- Parameters:
productWriter- the product writer to be used to remove this node from the underlying file.
-