01: package it.geosolutions.imageio.plugins.jhdf.aps;
02:
03: import it.geosolutions.imageio.plugins.jhdf.BaseHDFImageMetadata;
04: import it.geosolutions.imageio.plugins.jhdf.SubDatasetInfo;
05:
06: import javax.imageio.metadata.IIOInvalidTreeException;
07: import javax.imageio.metadata.IIOMetadataNode;
08:
09: import ncsa.hdf.object.Dataset;
10:
11: import org.w3c.dom.Node;
12:
13: public class APSImageMetadata extends BaseHDFImageMetadata {
14: public static final String nativeMetadataFormatName = "it.geosolutions.imageio.plugins.jhdf.aps.APSImageMetadata_1.0";
15:
16: public static final String[] metadataFormatNames = { nativeMetadataFormatName };
17:
18: protected final int[] mapMutex = new int[1];
19:
20: /**
21: * private fields for metadata node building
22: */
23:
24: // protected Map attributesMap = Collections.synchronizedMap(new HashMap(19));
25: public Node getAsTree(String formatName) {
26: if (formatName.equals(nativeMetadataFormatName)) {
27: return getNativeTree();
28: } else {
29: throw new IllegalArgumentException(
30: "Not a recognized format!");
31: }
32: }
33:
34: private Node getNativeTree() {
35: final IIOMetadataNode root = new IIOMetadataNode(
36: nativeMetadataFormatName);
37: /**
38: * Setting Dataset Properties common to any sub-format
39: */
40:
41: root.appendChild(getCommonDatasetNode());
42: return root;
43: }
44:
45: public APSImageMetadata() {
46: super (false, nativeMetadataFormatName, null, null, null);
47: }
48:
49: public APSImageMetadata(Dataset dataset) {
50: this ();
51: initializeFromDataset(dataset);
52: }
53:
54: public APSImageMetadata(SubDatasetInfo sdInfo) {
55: this ();
56: initializeFromDataset(sdInfo);
57: }
58:
59: private void initializeFromDataset(SubDatasetInfo sdInfo) {
60: initializeCommonDatasetProperties(sdInfo);
61: //TODO: Add further initializations APS specific?
62: }
63:
64: /**
65: * Initialize Metadata from a raster
66: *
67: * @param raster
68: * the <code>SwanRaster</code> from which retrieve data
69: * @param imageIndex
70: * the imageIndex relying the required subdataset
71: */
72: private void initializeFromDataset(final Dataset dataset) {
73: //Initializing common properties to each HDF dataset.
74: initializeCommonDatasetProperties(dataset);
75: //TODO: Add further initializations APS specific?
76: }
77:
78: public boolean isReadOnly() {
79: // TODO Auto-generated method stub
80: return false;
81: }
82:
83: public void mergeTree(String formatName, Node root)
84: throws IIOInvalidTreeException {
85: // TODO Auto-generated method stub
86:
87: }
88:
89: public void reset() {
90: // TODO Auto-generated method stub
91:
92: }
93:
94: }
|