|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.cddb.FreeDB
public class FreeDB
FreeDB implements the connection to a freedb.org server or one of its mirrors.
The FreeDB.org server fully supports the CDDB protocol.
You can configure the default connection
settings by altering the following properties in
com.antelmann.util.Settings:
cddb.clientcddb.client.versionuser.emailuser.email property is used when submitting an entry
to the database as a return address.
It defaults to cddb@antelmann.com if it is not set otherwise.
user.name to identify the user connecting to the service.
Settings,
setServer(CDDBServer)| Constructor Summary | |
|---|---|
FreeDB()
uses CDDBServer.DEFAULT_SERVER |
|
FreeDB(CDDBServer server)
|
|
| Method Summary | |
|---|---|
String[] |
getCategories()
returns the available categories under which the CDInfo entries are stored - in accordance to the CDDB standard |
String |
getMessageOfTheDay()
returns a 'message of the day' quote from freedb.org |
String |
getUserEmail()
|
boolean |
isInTestMode()
determines whether submissions will be treated as a test or a real submission; defaults to true |
CDDBServer[] |
listSites()
returns sites that can be used as a mirror for this service. |
protected String |
performCommand(String command)
This method is called for every command supported by the interface and returns the result as it is provided by the service. |
CDDBRecord[] |
queryCD(CDID cd)
queries the database and returns an array of matches. |
CDInfo |
readCDInfo(CDDBRecord record)
it is suggested that the given record was obtained through a call to queryCD(), so that the record is known to exist. |
void |
setServer(CDDBServer server)
changes the site location used to access the service; the protocol for the server must be http |
void |
setTestMode(boolean on)
determines whether submissions will be treated as a test or a real submission |
void |
setUserEmail(String userEmail)
used when submitting a CDInfo object to the server using writeCDInfo(). |
boolean |
verifyDiscID(CDID cd)
tries to verify the discid embedded in the CDID object by querying the service to recalculate the data |
void |
writeCDInfo(CDInfo cdinfo)
submits the CDInfo object to the FreeDB. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FreeDB()
throws IOException
IOExceptionCDDBServer.DEFAULT_SERVER
public FreeDB(CDDBServer server)
throws IOException
IOExceptionsetServer(CDDBServer)| Method Detail |
|---|
public void setUserEmail(String userEmail)
writeCDInfo().
If not set, the value defaults to Settings.getProperty("user.email")
or "cddb@antelmann.com" if the user.email property is not present.
#see #writeCDInfo(CDInfo)
public String getUserEmail()
public boolean isInTestMode()
setTestMode(boolean)public void setTestMode(boolean on)
isInTestMode()
public void setServer(CDDBServer server)
throws IOException,
IllegalArgumentException
IllegalArgumentException - if the server protocol is not http
IOException - if the local hostname could not be resolvedlistSites(),
CDDBServer
protected String performCommand(String command)
throws IOException
Currently, this method is implemented to use the HTTP protocol with GET. If other protocols were to be supported (i.e. HTTP POST or Telnet), only this method needs to be changed/overridden.
command - the entire client command as specified in the CDDB
protocol; example: "cddb lscat"
IOException
public String getMessageOfTheDay()
throws IOException
IOException
public CDDBServer[] listSites()
throws IOException,
CDDBProtocolException
IOException
CDDBProtocolExceptionsetServer(CDDBServer),
Settings,
CDDBServer
public String[] getCategories()
throws IOException,
CDDBProtocolException
CDDB
getCategories in interface CDDBIOException
CDDBProtocolException
public boolean verifyDiscID(CDID cd)
throws IOException,
CDDBProtocolException
IOException
CDDBProtocolException
public CDDBRecord[] queryCD(CDID cd)
throws IOException,
CDDBProtocolException
CDDBisExactMatch()
on any returned element.
queryCD in interface CDDBIOException
CDDBProtocolExceptionCDDBRecord.isExactMatch()
public CDInfo readCDInfo(CDDBRecord record)
throws IOException,
CDDBProtocolException
readCDInfo in interface CDDBCDDBProtocolException - if the record doesn't exist
IOExceptionCDDBEntry
public void writeCDInfo(CDInfo cdinfo)
throws IOException,
CDDBProtocolException
writeCDInfo in interface CDDBIOException
CDDBProtocolExceptionsetUserEmail(String),
setTestMode(boolean)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||