public class StkSatelliteDatabase extends Object
The following example shows how to query the satellite database for satellites matching certain criteria:
StkSatelliteDatabase db = new StkSatelliteDatabase(dbDirectory, "stkSatDb");
// Create a query object and then populate it with the properties to query on.
// Regular expressions are used to query on strings.
StkSatelliteDatabaseQuery query = new StkSatelliteDatabaseQuery();
query.setCommonName(Pattern.compile("QUICK"));
query.setMinimumApogee(200000.0);
// Get the database entries matching the query and print out the SSC number of each.
for (StkSatelliteDatabaseEntry entry : db.getEntries(query)) {
System.out.println(entry.getSatelliteNumber());
}
For more information on the files that define the satellite database, see the the Satellite Database Files topic.
Constructor and Description |
---|
StkSatelliteDatabase(StreamFactory streamFactory)
Initializes a new instance which will read data from a ZIP archive containing satellite database files.
|
StkSatelliteDatabase(String zipFileName)
Initializes a new instance which will read data from a ZIP archive containing satellite database files.
|
StkSatelliteDatabase(String directory,
String baseFileName)
Initializes a new instance which will read data from a directory of satellite database files.
|
Modifier and Type | Method and Description |
---|---|
static StkSatelliteDatabase |
download()
Downloads the current
stkSatDbAll satellite database from an AGI server. |
static StkSatelliteDatabase |
download(Proxy proxy)
Downloads the current
stkSatDbAll satellite database from an AGI server. |
static StkSatelliteDatabase |
download(Proxy proxy,
StkSatelliteDatabaseType type)
Downloads a current satellite database from an AGI server.
|
static StkSatelliteDatabase |
download(StkSatelliteDatabaseType type)
Downloads a current satellite database from an AGI server.
|
ArrayList<StkSatelliteDatabaseEntry> |
getEntries()
Gets all of the entries in the database.
|
ArrayList<StkSatelliteDatabaseEntry> |
getEntries(StkSatelliteDatabaseQuery query)
Gets all of the entries in the database matching a specified query.
|
GregorianDate |
getLastUpdateDate()
Gets the last update date reported in the Generic Database (.gd) file, or
GregorianDate.MinValue
if the file does not exist or does not contain a LastUpdate field. |
ArrayList<String> |
getMissions()
Gets the missions of the spacecraft in the database.
|
ArrayList<String> |
getOwners()
Gets the owners of the spacecraft in the database.
|
String |
getVersion()
Gets the version number reported in the Generic Database (.gd) file, or "Unknown" if
the file does not exist or does not contain a Version field.
|
public StkSatelliteDatabase(@Nonnull String directory, @Nonnull String baseFileName)
directory
- The directory in which the satellite database is located.baseFileName
- The base filename (without extension) of the database within the directory.ArgumentNullException
- Thrown when directory
or baseFileName
is null
.public StkSatelliteDatabase(@Nonnull String zipFileName)
zipFileName
- The ZIP filename containing the satellite database.ArgumentNullException
- Thrown when zipFileName
is null
.public StkSatelliteDatabase(@Nonnull StreamFactory streamFactory)
streamFactory
- The factory to use to create streams to read the ZIP file.ArgumentNullException
- Thrown when streamFactory
is null
.@Nonnull public static StkSatelliteDatabase download()
stkSatDbAll
satellite database from an AGI server.
This method connects via HTTPS to ftp.agi.com.
Note that an internet connection is required to use this method successfully.
StkSatelliteDatabase
containing satellite information.DataUnavailableException
- Thrown when the data cannot be retrieved from the server.@Nonnull public static StkSatelliteDatabase download(@Nullable Proxy proxy)
stkSatDbAll
satellite database from an AGI server.
This method connects via HTTPS to ftp.agi.com.
Note that an internet connection is required to use this method successfully.
proxy
- Proxy to use when connecting.StkSatelliteDatabase
containing satellite information.DataUnavailableException
- Thrown when the data cannot be retrieved from the server.@Nonnull public static StkSatelliteDatabase download(@Nonnull StkSatelliteDatabaseType type)
Note that an internet connection is required to use this method successfully.
type
- The type of satellite database to download.StkSatelliteDatabase
containing satellite information.DataUnavailableException
- Thrown when the data cannot be retrieved from the server.@Nonnull public static StkSatelliteDatabase download(@Nullable Proxy proxy, @Nonnull StkSatelliteDatabaseType type)
Note that an internet connection is required to use this method successfully.
proxy
- Proxy to use when connecting.type
- The type of satellite database to download.StkSatelliteDatabase
containing satellite information.DataUnavailableException
- Thrown when the data cannot be retrieved from the server.public final String getVersion()
@Nonnull public final GregorianDate getLastUpdateDate()
GregorianDate.MinValue
if the file does not exist or does not contain a LastUpdate field.@Nonnull public final ArrayList<String> getOwners()
@Nonnull public final ArrayList<String> getMissions()
@Nonnull public final ArrayList<StkSatelliteDatabaseEntry> getEntries()
@Nonnull public final ArrayList<StkSatelliteDatabaseEntry> getEntries(@Nullable StkSatelliteDatabaseQuery query)
query
- The query that returned entries must match,
or null
to return all entries.InvalidDataException
- Thrown when a required data file was not found.