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 * @version 2.7.2 7/6/2010 032 * @author Nidhi Gupta 033 */ 034 035public class H5Link extends HObject { 036 /** 037 * 038 */ 039 private static final long serialVersionUID = -8137277460521594367L; 040 041 private H5O_info_t obj_info; 042 043 /** 044 * Constructs an HDF5 link with specific name, path, and parent. 045 * 046 * @param theFile 047 * the file which containing the link. 048 * @param name 049 * the name of this link, e.g. "link1". 050 * @param path 051 * the full path of this link, e.g. "/groups/". 052 */ 053 public H5Link(FileFormat theFile, String name, String path) { 054 this (theFile, name, path, null); 055 } 056 057 public H5Link(FileFormat theFile, String theName, String thePath, 058 long[] oid) { 059 super(theFile, theName, thePath, oid); 060 061 obj_info = new H5O_info_t(-1L, -1L, -1, 0, -1L, 0L, 0L, 0L, 0L, null,null,null); 062 } 063 064 @Override 065 public void close(int id) { 066 } 067 068 @Override 069 public int open() { 070 return 0; 071 } 072 073 public List getMetadata() throws Exception { 074 075 try{ 076 this.linkTargetObjName= H5File.getLinkTargetName(this); 077 }catch(Exception ex){ 078 } 079 080 return null; 081 } 082 083 public boolean hasAttribute() { 084 return false; 085 } 086 087 public void removeMetadata(Object info) throws Exception { 088 } 089 090 public void writeMetadata(Object info) throws Exception { 091 } 092 093 public void updateMetadata(Object info) throws Exception { 094 } 095 096 public List getMetadata(int... attrPropList) throws Exception { 097 return null; 098 } 099 100 /* 101 * (non-Javadoc) 102 * 103 * @see hdf.object.HObject#setName(java.lang.String) 104 */ 105 @Override 106 public void setName(String newName) throws Exception { 107 H5File.renameObject(this, newName); 108 super.setName(newName); 109 } 110}