visad.data
Class Repository

java.lang.Object
  extended by visad.data.Repository
Direct Known Subclasses:
DirectoryRepository

public abstract class Repository
extends Object

A repository of persistent data objects. This class implements the "abstract factory" design pattern. The concrete implementation of this class could either be "DirectoryRepository" (for accessing files residing on local disk) or "RemoteRepository" (for accessing remote files via a server) or something else. The concrete class of the "Form" objects will be determined by this class's concrete class (and, hence, so will the concrete class of any constructed "FileAccessor").


Field Summary
protected  FormNode forms
          The data forms supported by this repository.
 
Constructor Summary
Repository(String name, String location)
          Construct a data repository.
 
Method Summary
 void add(String id, Data data, boolean replace)
          Add a data object to an existing data object in the repository.
protected abstract  String fullName(String id)
          Return the fully-qualified name of a persistent data object.
abstract  Enumeration getEnumeration()
          Return an enumeration of the data objects in this repository.
 FormNode getForms()
          Return the forms of data that are supported by this repository.
 FormNode getForms(Data data)
          Return the forms of data that are both supported by this repository and compatible with a data object.
 String getLocation()
          Return the location of this repository.
 String getName()
          Return the name of this repository.
 DataImpl open(String id)
          Open an existing data object in the repository.
 DataImpl open(URL url)
          Open a data object specified as a URL.
 void save(String id, Data data, boolean replace)
          Save a data object in the first compatible data form.
 void save(String id, Data data, FormNode form, boolean replace)
          Save a data object in a particular form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forms

protected FormNode forms
The data forms supported by this repository.

Constructor Detail

Repository

public Repository(String name,
                  String location)
Construct a data repository.

Method Detail

getName

public String getName()
Return the name of this repository.


getLocation

public String getLocation()
Return the location of this repository.


getForms

public FormNode getForms()
Return the forms of data that are supported by this repository.


getForms

public FormNode getForms(Data data)
                  throws VisADException,
                         IOException,
                         RemoteException
Return the forms of data that are both supported by this repository and compatible with a data object.

Throws:
VisADException
IOException
RemoteException

getEnumeration

public abstract Enumeration getEnumeration()
                                    throws BadRepositoryException,
                                           SecurityException
Return an enumeration of the data objects in this repository.

Throws:
BadRepositoryException
SecurityException

save

public void save(String id,
                 Data data,
                 boolean replace)
          throws VisADException,
                 IOException,
                 RemoteException
Save a data object in the first compatible data form.

Throws:
VisADException
IOException
RemoteException

save

public void save(String id,
                 Data data,
                 FormNode form,
                 boolean replace)
          throws VisADException,
                 RemoteException,
                 IOException
Save a data object in a particular form.

Throws:
VisADException
RemoteException
IOException

add

public void add(String id,
                Data data,
                boolean replace)
         throws VisADException
Add a data object to an existing data object in the repository.

Throws:
VisADException

open

public DataImpl open(String id)
              throws VisADException,
                     IOException
Open an existing data object in the repository.

Throws:
VisADException
IOException

open

public DataImpl open(URL url)
              throws VisADException,
                     IOException
Open a data object specified as a URL. Strictly speaking, this shouldn't be here because a URL can lie outside the domain of the repository. A repository, however, is characterized by the data forms that it handles as well as its "location". Consequently, we have this method.

Throws:
VisADException
IOException

fullName

protected abstract String fullName(String id)
Return the fully-qualified name of a persistent data object.