stsci.client
Class ArchiveClient
java.lang.Object
|
+--stsci.client.ArchiveClient
- public class ArchiveClient
- extends java.lang.Object
This hides the implemnentation of ArchiveServer even more from the client code. Depending on the REMOTE property a local ArchiveServerImpl is created or an RMI version is requested from the server.
The client keeps track of which archives have been loaded - client code should use getArchive from this class rather than calling directly from the ArchiveDescriptor.
Constructor Summary |
protected |
ArchiveClient()
Protected constructor - this is a singleton, use getArchiveClient to get the single instance. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
descriptors
protected ArchiveDescriptor[] descriptors
theClient
protected static ArchiveClient theClient
archives
protected Archive[] archives
ArchiveClient
protected ArchiveClient()
- Protected constructor - this is a singleton, use getArchiveClient to get the single instance. When its constructed it contacts the ArchiveServer once to get the list of Descriptors.
getArchive
public Archive getArchive(java.lang.String name)
throws NotFoundException
- Get the archive of the given name. Uses the other getArchive with a number once it locates the named archive. Only implemented a simple linear search since there will never be that many archives that this would be too slow. Also the client is more likely to request the whole list of Archives and then work with the numbers.
getArchive
public Archive getArchive(int num)
throws NotFoundException
- Get the numbered archive where the number is zero offset in the list of returned archives from listArchives. The client actually keeps track of which archives have been requested and does not construct new archives unless it needs to. Hence client code can always come back here to get a handle on an archive and it will get the same archive not a new instance.
getArchiveClient
public static ArchiveClient getArchiveClient()
- This is a singleton use this method to get the instance.
countArchives
public int countArchives()
- Number of archive descriptors the client got from the ArchiveServer.
getDescriptor
public ArchiveDescriptor getDescriptor(int num)
throws NotFoundException
- Get the ArchiveDescriptor at the numbered position. This is needed to get names and information about the archives without actually constructing them. The CatalogPanel uses this for example to construct the menu of available archives.
getArchiveServer
public static ArchiveServer getArchiveServer()
- This get the archive server implementaion. If REMOTE is yes it goes to the specified RMI sercer to pick up the ArchiveServer. Otherwise it constructs an ArchiveServerImpl locally. This does mean the Server code needs to be on the client machine but since the object is constructed from its String name there is no actual dependancy on it - hence the client code can be shiped without the server class and it will work using REMOTE="yes" however if the ArchiveServerImpl code is available you may sepcify REMOTE="no" and this will work also.