Dark Planet Development Platform

Get Dark Planet Development Platform at SourceForge.net. Fast, secure and Free Open Source software downloads

EVE Static Data API

The EVE Static Data API provides methods for accessing the static data dumps provided by CCP. CCP provides this data as a Microsoft SQLServer backup which can then be converted and loaded into various database back ends. The DPS static data API abstracts over these database roots to allow the possibility of more generic access. For example, one could imagine retrieving static data from a simple file cache, or even a web-based service. As a result, the DPS static data API is modelled as a set of object factories which can provide either individual static data objects, or collections of objects according to various criteria. To be sure, this is much less flexible than a Hibernate-based API or even direct SQL access, but we find that most applications which use static data are only performing simple lookups and cross-referencing rather than complex queries.

API Overview

The main gateway interface for static data is org.dps.core.database.IEveDatabase. This interface provides a method for obtaining the object factory for every table exposed in the static data dump. A typical factory is org.dps.core.database.agt.IAgtAgentTypesFactory which can be used to list all the agent types in EVE. This factory provides two methods:

Return value Method Function
Collection<IAgtAgentTypes> getAll() Returns a collection of all agent type objects.
IAgtAgentTypes getFromId(int id) Returns the IAgtAgentTypes with the given agent type ID, or null if no agent exists with the given type.

The IAgtAgentTypesFactory interface is typical for tables with a single index field (i.e. SQL table column). For tables with multiple index fields, the factory will provide separate methods for retrieving collections by each index field. An example is org.dps.core.database.agt.IAgtConfigFactory which has methods:

Return value Method Function
Collection<IAgtConfig> getAll() Returns a collection of all agent config objects.
Collection<IAgtConfig> getAllByAgentId(int id) Returns a collection of all agent config objects with the given agent ID.
Collection<IAgtConfig> getAllByKey(String key) Returns a collection of all agent config objects with the given key.
IAgtConfig getFromId(int id, String key) Returns the IAgtConfig with the given agent ID and key, or null if no such agent config exists.

The objects returned by the factory interfaces implement methods which provide access to each of the fields in the static table. Many of the static data tables are cross-referenced. We reflect this in the static data API using object references. This means you won't need to perform additional lookups to get a reference to naturally cross-referenced data. A simple example of this is IMapRegionJumps:

Return value Method Function
int getFromRegionID() Returns the region ID of the source of the jump.
IMapRegions getFromRegionIDObject() Returns the IMapRegions object corresponding to the source of the jump.
int getToRegionID() Returns the region ID of the destination of the jump.
IMapRegions getToRegionIDObject() Returns the IMapRegions object corresponding to the destination of the jump.

The convention for all static data object interfaces is to return both the raw data for cross-references (e.g. the value of the cross-reference field) as well as an object reference for the cross-reference (e.g. the object which would be obtained by calling getFromId on the appropriate factory interface). Methods which return the cross-reference as an object have Object appended to the method name. Note that occasionally there are missing cross-references in the static data dumps, and thus the object form of the cross-reference may return null.

Retrieving Data Objects

Data objects are simple to retrieve once you have an instance of IEveDatabase. Here's an example which displays all the agent types:

    IEveDatabase database = ...get database reference...;
    
    for (IAgtAgentTypes type : database.getAgtAgentTypesFactory().getAll())
      System.out.println("type = " + type);

A word of caution: some of the static data tables are quite large so use the getAll method with care.