org.dps.core.persist
Interface IEvePersistenceFactory


public interface IEvePersistenceFactory

The implementor of this interface provides persistence functions to the data and market data layers. Stored data is referenced by a key ID, which corresponds to the key ID of the customized API key used for synchronizing data with the EVE servers. External market data is public information and is therefore not associated with a key ID. NOTE: The way this API is structured requires that you use a separate customizable API key (i.e. unique key ID) for each character. This API does NOT allow you to reuse a single key ID for all your characters even though the customizable API key system allows this.


Method Summary
 java.util.Collection<java.lang.Integer> getCharacterKeys()
          Returns a list of key IDs corresponding to characters stored by this persistence factory.
 java.util.Collection<java.lang.Integer> getCorporationKeys()
          Returns a list of key IDs corresponding to corporations stored by this persistence factory.
 org.hibernate.SessionFactory getGenericDataSessionFactory()
          Retrieve a session factory which may be used to access generic information tables, for example external market data.
 org.hibernate.SessionFactory getKeySessionFactory(int keyID)
          Retrieve a session factory with access to the tables associated with the specified key ID.
 ICharacterContactNotificationRecord getNewCharacterContactNotificationRecord(int keyID, long charID, long notificationID)
          Instantiate a new CharacterContactNotificationRecord ready for population.
 ICharacterMailMessageBodyRecord getNewCharacterMailMessageBodyRecord(int keyID, long charID, long messageID)
          Instantiate a new CharacterMailMessageBodyRecord ready for population.
 ICharacterMailMessageDestinationRecord getNewCharacterMailMessageDestinationRecord(int keyID, long charID, long messageID, long toCharID)
          Instantiate a new CharacterMailMessageDestinationRecord ready for population.
 ICharacterMailMessageRecord getNewCharacterMailMessageRecord(int keyID, long charID, long messageID)
          Instantiate a new CharacterMailMessageRecord ready for population.
 ICharacterNotificationRecord getNewCharacterNotificationRecord(int keyID, long charID, long notificationID)
          Instantiate a new CharacterNotificationRecord ready for population.
 ICharacterNotificationTextRecord getNewCharacterNotificationTextRecord(int keyID, long charID, long notificationID)
          Instantiate a new CharacterNotificationTextRecord ready for population.
 IContainerLogRecord getNewContainerLogRecord(int keyID, long corpID, long logTime, long itemID, long actorID, java.lang.String action)
          Instantiate a new ContainerLogRecord ready for population.
 IExternalHistoricTradeRecord getNewExternalHistoricTradeRecord(int typeID, long regionID, long date, java.lang.String source)
          Instantiate a new ExtenralHistoricTradeRecord ready for population.
 IExternalMarketOrderRecord getNewExternalMarketOrderRecord(long orderID, int typeID, long stationID, java.lang.String source)
          Instantiate a new ExternalMarketOrderRecord ready for population.
 IIndustryJobRecord getNewIndustryJobRecord(int keyID, long charOrCorpID, long jobID, long assemblyID, long containerID)
          Instantiate a new IndustryJobRecord ready for population.
 IWalletJournalRecord getNewJournalRecord(int keyID, long charOrCorpID, int accountKey, long refID)
          Instantiate a new WalletJournalRecord ready for population.
 IKillAttackerRecord getNewKillAttackerRecord(int keyID, long charOrCorpID, long killID, long attackerID)
          Instantiate a new KillAttackerRecord ready for population.
 IKillItemRecord getNewKillItemRecord(int keyID, long charOrCorpID, long killID, int typeID)
          Instantiate a new KillItemRecord ready for population.
 IKillRecord getNewKillRecord(int keyID, long charOrCorpID, long killID)
          Instantiate a new KillRecord ready for population.
 IKillVictimRecord getNewKillVictimRecord(int keyID, long charOrCorpID, long killID)
          Instantiate a new KillVictimRecord ready for population.
 IMarketOrderRecord getNewMarketOrderRecord(int keyID, long charOrCorpID, long orderID)
          Instantiate a new MarketOrderRecord ready for population.
 IMemberSecurityLogRecord getNewMemberSecurityLogRecord(int keyID, long corpID, long changeTime, long changedCharID, long issuerID)
          Instantiate a new MemberSecurityLogRecord ready for population.
 IMemberSecurityLogRoleRecord getNewMemberSecurityLogRoleRecord(int keyID, long corpID, long changeTime, long changedCharID, long issuerID, boolean newRole, long roleID)
          Instantiate a new MemberSecurityLogRoleRecord ready for population.
 IWalletTransactionRecord getNewTransactionRecord(int keyID, long charOrCorpID, int accountKey, long transID)
          Instantiate a new WalletTransactionRecord ready for population.
 Capsuleer loadCharacter(int keyID)
          Reload a persisted Character instance corresponding to the given key ID.
 Corporation loadCorporation(int keyID)
          Reload a persisted Corporation instance corresponding to the given key ID.
 void saveCharacter(Capsuleer c)
          Persist the given Character instance.
 void saveCorporation(Corporation c)
          Persist the given Corporation instance.
 

Method Detail

getCharacterKeys

java.util.Collection<java.lang.Integer> getCharacterKeys()
Returns a list of key IDs corresponding to characters stored by this persistence factory.

Returns:
a list of key IDs corresponding to stored character information.

getCorporationKeys

java.util.Collection<java.lang.Integer> getCorporationKeys()
Returns a list of key IDs corresponding to corporations stored by this persistence factory.

Returns:
a list of keys IDs corresponding to stored corporation information.

loadCharacter

Capsuleer loadCharacter(int keyID)
                        throws java.io.IOException,
                               NoSuchCharacterException,
                               java.lang.ClassNotFoundException
Reload a persisted Character instance corresponding to the given key ID.

Parameters:
keyID - the key ID under which this character was persisted.
Returns:
the restored instance of Character associated with this key ID.
Throws:
java.io.IOException - if an IO error occurs during restoration.
NoSuchCharacterException - if the given key ID does not correspond to a persisted Character.
java.lang.ClassNotFoundException - if a type error occurs while restoring the Character (this can occur due to a version difference, or if an implementor chooses to extend the data model with their own classes).

saveCharacter

void saveCharacter(Capsuleer c)
                   throws java.io.IOException
Persist the given Character instance.

Parameters:
c - the Character to persist. The persisted character may be retrieved according to the key ID stored in the character.
Throws:
java.io.IOException - if an IO error occurs while persisting the character.

loadCorporation

Corporation loadCorporation(int keyID)
                            throws java.io.IOException,
                                   NoSuchCorporationException,
                                   java.lang.ClassNotFoundException
Reload a persisted Corporation instance corresponding to the given key ID.

Parameters:
keyID - the key ID under which this corporation was persisted.
Returns:
the restored instance of Corporation associated with this key ID.
Throws:
java.io.IOException - if an IO error occurs during restoration.
NoSuchCorporationException - if the given key ID does not correspond to a persisted Corporation.
java.lang.ClassNotFoundException - if a type error occurs while restoring the Corporation(this can occur due to a version difference, or if an implementor chooses to extend the data model with their own classes).

saveCorporation

void saveCorporation(Corporation c)
                     throws java.io.IOException
Persist the given Corporation instance.

Parameters:
c - the Corporation to persist. The persisted corporation may be retrieved according to the key ID stored in the corporation.
Throws:
java.io.IOException - if an IO error occurs while persisting the corporation.

getKeySessionFactory

org.hibernate.SessionFactory getKeySessionFactory(int keyID)
                                                  throws org.hibernate.HibernateException
Retrieve a session factory with access to the tables associated with the specified key ID. Implementations are expected to initialize a new data area if none already exists for the specified key ID. This new data area should be populated with the appropriate (empty) tables for storing character or corporation specific information. All record types include the key ID so it is safe for the implementor to use a single set of tables for all key IDs should they choose to do so.

Parameters:
keyID - the key ID for which a session factory is being requested.
Returns:
a SessionFactory which may be used for key ID related database operations.
Throws:
org.hibernate.HibernateException - if an error occurs while setting up the factory.

getGenericDataSessionFactory

org.hibernate.SessionFactory getGenericDataSessionFactory()
                                                          throws org.hibernate.HibernateException
Retrieve a session factory which may be used to access generic information tables, for example external market data. Implementations are expected to initialize a new data area if none already exists for storing generic data. This new data area should be populated with the appropriate (empty) tables for storing generic information.

Returns:
a SessionFactory which may be used for general database operations.
Throws:
org.hibernate.HibernateException - if an error occurs while setting up the factory.

getNewJournalRecord

IWalletJournalRecord getNewJournalRecord(int keyID,
                                         long charOrCorpID,
                                         int accountKey,
                                         long refID)
Instantiate a new WalletJournalRecord ready for population.

Parameters:
keyID - the key ID of the character or corporation storing the record.
charOrCorpID - the character or corporation ID on whose behalf the record is being stored.
accountKey - the character or corporation account number where the record was recorded.
refID - the unique reference ID for the record.
Returns:
a new instance of IWalletJournalRecord.

getNewTransactionRecord

IWalletTransactionRecord getNewTransactionRecord(int keyID,
                                                 long charOrCorpID,
                                                 int accountKey,
                                                 long transID)
Instantiate a new WalletTransactionRecord ready for population.

Parameters:
keyID - the key ID of the character or corporation storing the record.
charOrCorpID - the character or corporation ID on whose behalf the record is being stored.
accountKey - the character or corporation account number where the record was recorded.
transID - the unique transaction ID for the record.
Returns:
a new instance of IWalletTransactionRecord.

getNewCharacterNotificationRecord

ICharacterNotificationRecord getNewCharacterNotificationRecord(int keyID,
                                                               long charID,
                                                               long notificationID)
Instantiate a new CharacterNotificationRecord ready for population.

Parameters:
keyID - key ID of receiving character.
charID - character ID of receiving character.
notificationID - unique ID of notification.
Returns:
an instance of ICharacterNotificationRecord.

getNewCharacterNotificationTextRecord

ICharacterNotificationTextRecord getNewCharacterNotificationTextRecord(int keyID,
                                                                       long charID,
                                                                       long notificationID)
Instantiate a new CharacterNotificationTextRecord ready for population.

Parameters:
keyID - key ID of receiving character.
charID - character ID of receiving character.
notificationID - unique ID of notification.
Returns:
an instance of ICharacterNotificationTextRecord.

getNewCharacterMailMessageRecord

ICharacterMailMessageRecord getNewCharacterMailMessageRecord(int keyID,
                                                             long charID,
                                                             long messageID)
Instantiate a new CharacterMailMessageRecord ready for population.

Parameters:
keyID - key ID of receiving character.
charID - character ID of receiving character.
messageID - unique ID of message
Returns:
an instance of ICharacterMailMessageRecord.

getNewCharacterMailMessageDestinationRecord

ICharacterMailMessageDestinationRecord getNewCharacterMailMessageDestinationRecord(int keyID,
                                                                                   long charID,
                                                                                   long messageID,
                                                                                   long toCharID)
Instantiate a new CharacterMailMessageDestinationRecord ready for population.

Parameters:
keyID - key ID of receiving character.
charID - character ID of receiving character.
messageID - unique ID of message
toCharID - character ID of a character which received this message.
Returns:
an instance of ICharacterMailMessageDestinationRecord.

getNewCharacterMailMessageBodyRecord

ICharacterMailMessageBodyRecord getNewCharacterMailMessageBodyRecord(int keyID,
                                                                     long charID,
                                                                     long messageID)
Instantiate a new CharacterMailMessageBodyRecord ready for population.

Parameters:
keyID - key ID of receiving character.
charID - character ID of receiving character.
messageID - unique ID of message
Returns:
an instance of ICharacterMailMessageBodyRecord.

getNewKillRecord

IKillRecord getNewKillRecord(int keyID,
                             long charOrCorpID,
                             long killID)
Instantiate a new KillRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charOrCorpID - character or corporation ID to whom the record belongs.
killID - unique ID of this kill.
Returns:
an instance of IKillRecord.

getNewKillAttackerRecord

IKillAttackerRecord getNewKillAttackerRecord(int keyID,
                                             long charOrCorpID,
                                             long killID,
                                             long attackerID)
Instantiate a new KillAttackerRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charOrCorpID - character or corporation ID to whom the record belongs.
killID - unique ID of this kill
attackerID - character ID of attacker identified by this record.
Returns:
an instance of IKillAttackerRecord.

getNewKillItemRecord

IKillItemRecord getNewKillItemRecord(int keyID,
                                     long charOrCorpID,
                                     long killID,
                                     int typeID)
Instantiate a new KillItemRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charOrCorpID - character or corporation ID to whom the record belongs.
killID - unique ID of this kill.
typeID - type ID of item.
Returns:
an instance of IKillItemRecord

getNewKillVictimRecord

IKillVictimRecord getNewKillVictimRecord(int keyID,
                                         long charOrCorpID,
                                         long killID)
Instantiate a new KillVictimRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charOrCorpID - character or corporation ID to whom the record belongs.
killID - unique ID of this kill.
Returns:
an instance of IKillVictimRecord.

getNewCharacterContactNotificationRecord

ICharacterContactNotificationRecord getNewCharacterContactNotificationRecord(int keyID,
                                                                             long charID,
                                                                             long notificationID)
Instantiate a new CharacterContactNotificationRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charID - character ID of character owning or accessing record.
notificationID - ID of this notification.
Returns:
an instance of ICharacterContactNotificationRecord.

getNewIndustryJobRecord

IIndustryJobRecord getNewIndustryJobRecord(int keyID,
                                           long charOrCorpID,
                                           long jobID,
                                           long assemblyID,
                                           long containerID)
Instantiate a new IndustryJobRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charOrCorpID - character or corporation ID to whom the record belongs.
jobID - job ID for this job.
assemblyID - assembly line ID where this job was installed.
containerID - container ID where the assembly for this job is hosted.
Returns:
an instance of IIndustryJobRecord.

getNewMarketOrderRecord

IMarketOrderRecord getNewMarketOrderRecord(int keyID,
                                           long charOrCorpID,
                                           long orderID)
Instantiate a new MarketOrderRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
charOrCorpID - character or corporation ID to whom the record belongs.
orderID - order ID for this order.
Returns:
an instance of IMarketOrderRecord.

getNewContainerLogRecord

IContainerLogRecord getNewContainerLogRecord(int keyID,
                                             long corpID,
                                             long logTime,
                                             long itemID,
                                             long actorID,
                                             java.lang.String action)
Instantiate a new ContainerLogRecord ready for population. Container log records are somewhat tricky to store in the DB. The example on the EVE api web page shows several rows which are exactly identical, meaning there's no obvious unique key. So to get around this we arbitrarily define the key as (logTime, itemID, actorID, action). These seem to be the key fields such that two entries which agree on these fields are probably equivalent anyway. What you will see as a result is that two rows returned from the API which are identical will only be stored once. This seems to be a reasonable sacrifice.

Parameters:
keyID - key ID of character owning or accessing record.
corpID - corporation ID of corporation which owns the container being logged.
logTime - time which the container action occurred.
itemID - ID of the container on which the action was performed.
actorID - ID of character which made the change.
action - change made to the container.
Returns:
an instance of IContainerLogRecord.

getNewMemberSecurityLogRecord

IMemberSecurityLogRecord getNewMemberSecurityLogRecord(int keyID,
                                                       long corpID,
                                                       long changeTime,
                                                       long changedCharID,
                                                       long issuerID)
Instantiate a new MemberSecurityLogRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
corpID - corporation ID to which this log record belongs.
changeTime - time at which the security change was made.
changedCharID - character ID of character which was changed.
issuerID - character ID of character making the change.
Returns:
an instance of IMemberSecurityLogRecord.

getNewMemberSecurityLogRoleRecord

IMemberSecurityLogRoleRecord getNewMemberSecurityLogRoleRecord(int keyID,
                                                               long corpID,
                                                               long changeTime,
                                                               long changedCharID,
                                                               long issuerID,
                                                               boolean newRole,
                                                               long roleID)
Instantiate a new MemberSecurityLogRoleRecord ready for population.

Parameters:
keyID - key ID of character owning or accessing record.
corpID - corporation ID to which this log record belongs.
changeTime - time at which the security change was made.
changedCharID - character ID of character which was changed.
issuerID - character ID of character making the change.
newRole - true if this is information about a new role for the changed character, false otherwise.
roleID - the role ID of the role being described.
Returns:
an instance of IMemberSecurityLogRoleRecord.

getNewExternalMarketOrderRecord

IExternalMarketOrderRecord getNewExternalMarketOrderRecord(long orderID,
                                                           int typeID,
                                                           long stationID,
                                                           java.lang.String source)
Instantiate a new ExternalMarketOrderRecord ready for population.

Parameters:
orderID - the unique order ID for this order.
typeID - the type being bought or sold for this order.
stationID - the station where the order was placed.
source - the source from which this data is being provided.
Returns:
an instance of IExternalMarketOrderRecord.

getNewExternalHistoricTradeRecord

IExternalHistoricTradeRecord getNewExternalHistoricTradeRecord(int typeID,
                                                               long regionID,
                                                               long date,
                                                               java.lang.String source)
Instantiate a new ExtenralHistoricTradeRecord ready for population.

Parameters:
typeID - the type for which the historic trade information corresponds.
regionID - the region where the historic trade occurred.
date - the timestamp on which the historic trade occurred.
source - the source from which this data is being provided.
Returns:
an instance of IExternalHistoricTradeRecord.