001/*****************************************************************************
002 * Copyright by The HDF Group.                                               *
003 * Copyright by the Board of Trustees of the University of Illinois.         *
004 * All rights reserved.                                                      *
005 *                                                                           *
006 * This file is part of the HDF Java Products distribution.                  *
007 * The full copyright notice, including terms governing use, modification,   *
008 * and redistribution, is contained in the files COPYING and Copyright.html. *
009 * COPYING can be found at the root of the source code distribution tree.    *
010 * Or, see https://support.hdfgroup.org/products/licenses.html               *
011 * If you do not have access to either file, you may request a copy from     *
012 * help@hdfgroup.org.                                                        *
013 ****************************************************************************/
014
015package hdf.object.fits;
016
017import java.util.List;
018
019import hdf.object.FileFormat;
020import hdf.object.Group;
021
022/**
023 * An H5Group represents HDF5 group, inheriting from Group.
024 * Every HDF5 object has at least one name. An HDF5 group is used to store
025 * a set of the names together in one place, i.e. a group. The general
026 * structure of a group is similar to that of the UNIX file system in
027 * that the group may contain references to other groups or data objects
028 * just as the UNIX directory may contain subdirectories or files.
029 * <p>
030 * @version 1.1 9/4/2007
031 * @author Peter X. Cao
032 */
033public class FitsGroup extends Group
034{
035    private static final long serialVersionUID = 4993155577664991838L;
036
037    /**
038     * The list of attributes of this data object. Members of the list are
039     * instance of Attribute.
040     */
041    private List attributeList;
042
043    /** The default object ID for HDF5 objects */
044    private static final long[] DEFAULT_OID = {0};
045
046    /**
047     * Constructs an HDF5 group with specific name, path, and parent.
048     * <p>
049     * @param fileFormat the file which containing the group.
050     * @param name the name of this group.
051     * @param path the full path of this group.
052     * @param parent the parent of this group.
053     * @param theID the unique identifier of this data object.
054     */
055    public FitsGroup(FileFormat fileFormat, String name, String path, Group parent, long[] theID) {
056        super (fileFormat, name, path, parent, ((theID == null) ? DEFAULT_OID : theID));
057    }
058
059    /*
060     * (non-Javadoc)
061     * @see hdf.object.DataFormat#hasAttribute()
062     */
063    public boolean hasAttribute () { return false; }
064
065    // Implementing DataFormat
066    public List getMetadata() throws Exception {
067        if (!isRoot()) {
068            return null; // there is only one group in the file: the root
069        }
070
071        if (attributeList != null) {
072            return attributeList;
073        }
074
075        return attributeList;
076    }
077
078    /**
079     * Creates a new attribute and attached to this dataset if attribute does
080     * not exist. Otherwise, just update the value of the attribute.
081     *
082     * @param info the atribute to attach
083     */
084    public void writeMetadata(Object info) throws Exception {
085        // not supported
086        throw new UnsupportedOperationException("Unsupported operation for FITS.");
087    }
088
089    /**
090     * Deletes an attribute from this dataset.
091     * <p>
092     * @param info the attribute to delete.
093     */
094    public void removeMetadata(Object info) throws Exception {
095        // not supported
096        throw new UnsupportedOperationException("Unsupported operation for FITS.");
097    }
098
099    /*
100     * (non-Javadoc)
101     * @see hdf.object.DataFormat#updateMetadata(java.lang.Object)
102     */
103    public void updateMetadata(Object info) throws Exception {
104        // not supported
105        throw new UnsupportedOperationException("Unsupported operation for FITS.");
106    }
107
108    // Implementing DataFormat
109    @Override
110    public long open() {
111        // not supported
112        throw new UnsupportedOperationException("Unsupported operation for FITS.");
113    }
114
115    /** close group access */
116    @Override
117    public void close(long gid) {
118        // not supported
119        throw new UnsupportedOperationException("Unsupported operation for FITS.");
120    }
121
122    /**
123     * Creates a new group.
124     * @param name the name of the group to create.
125     * @param pgroup the parent group of the new group.
126     *
127     * @return the new group if successful. Otherwise returns null.
128     *
129     * @throws Exception
130     *            if there is an error
131     */
132    public static FitsGroup create(String name, Group pgroup)
133        throws Exception {
134        // not supported
135        throw new UnsupportedOperationException("Unsupported operation for FITS.");
136    }
137
138    //Implementing DataFormat
139    public List getMetadata(int... attrPropList) throws Exception {
140        throw new UnsupportedOperationException("getMetadata(int... attrPropList) is not supported");
141    }
142
143}