LimeWire Consolidated API

com.limegroup.gnutella.licenses
Class AbstractLicense

java.lang.Object
  extended by com.limegroup.gnutella.licenses.AbstractLicense
All Implemented Interfaces:
License, MutableLicense, Serializable, Cloneable

public abstract class AbstractLicense
extends Object
implements MutableLicense, Serializable, Cloneable

A base license class, implementing common functionality.

See Also:
Serialized Form

Field Summary
protected  URI licenseLocation
          The URI where verification will be performed.
protected  int verified
          Whether or not this license has been verified.
 
Fields inherited from interface com.limegroup.gnutella.licenses.License
NO_LICENSE, UNVERIFIED, VERIFIED, VERIFYING
 
Method Summary
protected abstract  void clear()
          Clears all internal state that could be set while verifying.
protected  String getBody(String url, LimeHttpClient httpClient)
          Retrieves the body of a URL from a webserver.
protected  String getBodyFromURL(String url, LimeHttpClient httpClient)
          Contacts the given URL and downloads returns the body of the HTTP request.
 long getLastVerifiedTime()
          Returns the last time this license was verified.
 String getLicenseName()
          Gets the name of this license.
 URI getLicenseURI()
          Returns a URI that the user can visit to manually verify.
 boolean isVerified()
          True if this license has been externally verified.
 boolean isVerifying()
          True if this license is currently being or in queue for verification.
protected abstract  void parseDocumentNode(Node node, LicenseCache licenseCache, LimeHttpClient httpClient)
          Parses the document node of the XML.
protected  void parseXML(String xml, LicenseCache licenseCache, LimeHttpClient httpClient)
          Attempts to parse the given XML.
 void setLicenseName(String name)
           
 void verify(LicenseCache licenseCache, LimeHttpClient httpClient)
          Verifies the license.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.limegroup.gnutella.licenses.License
copy, getLicense, getLicenseDeed, getLicenseDescription, isValid
 

Field Detail

verified

protected transient int verified
Whether or not this license has been verified.


licenseLocation

protected transient URI licenseLocation
The URI where verification will be performed.

Method Detail

setLicenseName

public void setLicenseName(String name)
Specified by:
setLicenseName in interface MutableLicense

isVerifying

public boolean isVerifying()
Description copied from interface: License
True if this license is currently being or in queue for verification.

Specified by:
isVerifying in interface License

isVerified

public boolean isVerified()
Description copied from interface: License
True if this license has been externally verified. This does NOT indicate whether or not the license was valid.

Specified by:
isVerified in interface License

getLicenseName

public String getLicenseName()
Description copied from interface: License
Gets the name of this license. For example, "Creative Commons License", or "Weed License".

Specified by:
getLicenseName in interface License

getLicenseURI

public URI getLicenseURI()
Description copied from interface: License
Returns a URI that the user can visit to manually verify.

Specified by:
getLicenseURI in interface License

getLastVerifiedTime

public long getLastVerifiedTime()
Description copied from interface: License
Returns the last time this license was verified.

Specified by:
getLastVerifiedTime in interface License

clear

protected abstract void clear()
Clears all internal state that could be set while verifying.


getBody

protected String getBody(String url,
                         LimeHttpClient httpClient)
Retrieves the body of a URL from a webserver. Returns null if the page could not be found.


getBodyFromURL

protected String getBodyFromURL(String url,
                                LimeHttpClient httpClient)
Contacts the given URL and downloads returns the body of the HTTP request.


parseDocumentNode

protected abstract void parseDocumentNode(Node node,
                                          LicenseCache licenseCache,
                                          LimeHttpClient httpClient)
Parses the document node of the XML.


parseXML

protected void parseXML(String xml,
                        LicenseCache licenseCache,
                        LimeHttpClient httpClient)
Attempts to parse the given XML. The actual handling of the XML is sent to parseDocumentNode, which subclasses can implement as they see fit. If this is a request directly from our Verifier, 'liveData' is true. Subclasses may use this to know where the XML data is coming from.


verify

public void verify(LicenseCache licenseCache,
                   LimeHttpClient httpClient)
Description copied from interface: License
Verifies the license. The results of the verification can be retrieved by invoking License.isValid(URN).

Specified by:
verify in interface License

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.