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 http://hdfgroup.org/products/hdf-java/doc/Copyright.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.h5; 016 017import java.util.List; 018 019import hdf.hdf5lib.structs.H5O_info_t; 020import hdf.object.FileFormat; 021import hdf.object.HObject; 022 023/** 024 * An H5Link object represents an existing HDF5 object in file. 025 * <p> 026 * H5Link object is an HDF5 object that is either a soft or an external link to 027 * an object in a file that does not exist. The type of the object is unknown. 028 * Once the object being linked to is created, and the type is known, then 029 * H5link object will change its type. 030 * 031 * <p> 032 * 033 * @version 2.7.2 7/6/2010 034 * @author Nidhi Gupta 035 */ 036 037public class H5Link extends HObject { 038 /** 039 * 040 */ 041 private static final long serialVersionUID = -8137277460521594367L; 042 043 private H5O_info_t obj_info; 044 045 /** 046 * Constructs an HDF5 link with specific name, path, and parent. 047 * <p> 048 * 049 * @param theFile 050 * the file which containing the link. 051 * @param name 052 * the name of this link, e.g. "link1". 053 * @param path 054 * the full path of this link, e.g. "/groups/". 055 */ 056 public H5Link(FileFormat theFile, String name, String path) { 057 this (theFile, name, path, null); 058 } 059 060 public H5Link(FileFormat theFile, String theName, String thePath, 061 long[] oid) { 062 super(theFile, theName, thePath, oid); 063 064 obj_info = new H5O_info_t(-1L, -1L, -1, 0, -1L, 0L, 0L, 0L, 0L, null,null,null); 065 } 066 067 @Override 068 public void close(int id) { 069 } 070 071 @Override 072 public int open() { 073 return 0; 074 } 075 076 public List getMetadata() throws Exception { 077 078 try{ 079 this.linkTargetObjName= H5File.getLinkTargetName(this); 080 }catch(Exception ex){ 081 } 082 083 return null; 084 } 085 086 public boolean hasAttribute() { 087 return false; 088 } 089 090 public void removeMetadata(Object info) throws Exception { 091 } 092 093 public void writeMetadata(Object info) throws Exception { 094 } 095 096 public void updateMetadata(Object info) throws Exception { 097 } 098 099 public List getMetadata(int... attrPropList) throws Exception { 100 return null; 101 } 102 103 /* 104 * (non-Javadoc) 105 * 106 * @see hdf.object.HObject#setName(java.lang.String) 107 */ 108 @Override 109 public void setName(String newName) throws Exception { 110 H5File.renameObject(this, newName); 111 super.setName(newName); 112 } 113}