|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.hds.HDSReference
public class HDSReference
Stores the location of an HDS object. This class can store information about where an HDSObject is stored, including the container file it lives in and its location within that (its HDS path). Objects in this class, which are not immutable, can be used to navigate up and down an HDS path in a stack-like fashion, but pushing new elements on to the end of the HDS path and popping them off.
It also deals with translating object location information to and from a URL. Other classes ought to use this class to translate between URLs and HDS paths so that the HDS URL format can be changed easily in a single place. The format of a URL representing an HDS location is currently of the form container.sdf#hdspath. This may get changed.
Constructor Summary | |
---|---|
HDSReference(File container)
Constructs a new HDSReference representing the top level object in an HDS container file. |
|
HDSReference(File container,
String path)
Constructs an HDSReference given a container file and an HDS path string within it. |
|
HDSReference(File container,
String[] path)
Constructs an HDSReference given a container file and an HDS path array within it. |
|
HDSReference(HDSObject hobj)
Constructs an HDSReference from an existing HDSObject. |
|
HDSReference(String path)
Constructs an HDSRefernce from a 'traditional' HDS pathname. |
|
HDSReference(URL url)
Constructs an HDSReference from a URL. |
Method Summary | |
---|---|
Object |
clone()
Returns a copy of this object - modifying the returned object will not affect the original one. |
File |
getContainerFile()
Returns the container file associated with this HDSReference (including the '.sdf' extension). |
String |
getContainerName()
Returns the HDS-style name of the container file associated with this HDSReference - this does not include the '.sdf' extension. |
HDSObject |
getObject(String accessMode)
Opens a new primary HDSObject at the location referenced by this HDSReference. |
String[] |
getPath()
Returns the HDS path of this HDSReference as an array of Strings. |
URL |
getURL()
Returns a URL which describes this HDSReference. |
String |
pop()
Removes an element from the end of the current path, thus navigating up the HDS hierarchy. |
void |
push(String pathEl)
Adds a new path element to the end of the current path, thus navigating down the HDS hierarchy. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HDSReference(File container)
container
- a File object giving the container file
(including the .sdf extension)
IllegalArgumentException
- if the filename does not end '.sdf'public HDSReference(File container, String[] path)
container
- a File object giving the container file
(including the .sdf extension)path
- an array of Strings each representing the name
of one level of the HDS path
IllegalArgumentException
- if the filename does not
end in ".sdf"public HDSReference(File container, String path)
container
- a File object giving the container file
(including the .sdf extension)path
- a dot-separated string giving the HDS path
IllegalArgumentException
- if the filename does not end '.sdf'public HDSReference(String path)
path
- a dot-separated string in which the container name
minus its '.sdf' forms the front and the HDS path
proper forms the backpublic HDSReference(URL url)
url
- a URL describing the location of the HDSObject
UnsupportedOperationException
- if the protocol of url
is not filepublic HDSReference(HDSObject hobj) throws HDSException
hobj
- the object whose location is to be referenced.
HDSException
- if an HDS error occursMethod Detail |
---|
public File getContainerFile()
public String getContainerName()
public String[] getPath()
public URL getURL()
public HDSObject getObject(String accessMode) throws HDSException
accessMode
- the HDS access mode for the hdsOpen call -
"READ", "WRITE" or "UPDATE"
HDSException
public String toString()
toString
in class Object
public void push(String pathEl)
pathEl
- the new path element to addpublic String pop()
public Object clone()
clone
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |