org.dspace.license
Class CCLookup

java.lang.Object
  extended by org.dspace.license.CCLookup

public class CCLookup
extends Object

A wrapper around Creative Commons REST web services.

Author:
Wendy Bossons

Constructor Summary
CCLookup()
          Constructs a new instance with the default web services root.
 
Method Summary
protected  boolean contains(String token)
          contains is the token in the licenses vector
 String getErrorMessage()
           
 org.jdom.Document getLicenseDocument()
           
 Collection<CCLicenseField> getLicenseFields(String license)
          Queries the web service for a set of licenseFields for a particular license class.
 String getLicenseId(String class_label)
          Returns the id for a particular CCLicense label.
 String getLicenseName()
          Retrieves the human readable name for the license issued.
 Collection<CCLicense> getLicenses(String language)
          Queries the web service for the available licenses.
protected  StringTokenizer getLicenseTokens()
          getLicenseTokens
 String getLicenseUrl()
          Retrieves the URI for the license issued.
 String getRdf()
           
 boolean isSuccess()
           
 void issue(String licenseURI)
          Passes a set of "answers" to the web service and retrieves a license.
 void issue(String licenseId, Map answers, String lang)
          Passes a set of "answers" to the web service and retrieves a license.
protected  void sort()
          sort sort the licenses according to the configuration file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CCLookup

public CCLookup()
Constructs a new instance with the default web services root.

Method Detail

getLicenseId

public String getLicenseId(String class_label)
Returns the id for a particular CCLicense label. Returns an empty string if no match is found.

Parameters:
class_label - The CCLicense label to find.
Returns:
Returns a String containing the License class ID if the label is found; if not found, returns an empty string.
See Also:
CCLicense

getLicenses

public Collection<CCLicense> getLicenses(String language)
Queries the web service for the available licenses.

Parameters:
language - The language to request labels and description strings in.
Returns:
Returns a Map of CCLicense objects.
See Also:
Map, CCLicense

contains

protected boolean contains(String token)
contains is the token in the licenses vector

Parameters:
token -
Returns:
boolean

sort

protected void sort()
sort sort the licenses according to the configuration file


getLicenseTokens

protected StringTokenizer getLicenseTokens()
getLicenseTokens

Returns:
StringTokenizer representing the configured allowed license types (classes)

getLicenseFields

public Collection<CCLicenseField> getLicenseFields(String license)
Queries the web service for a set of licenseFields for a particular license class.

Parameters:
license - A String specifying the CCLicense identifier to retrieve fields for.
Returns:
A Collection of LicenseField objects.
See Also:
CCLicense, LicenseField

issue

public void issue(String licenseId,
                  Map answers,
                  String lang)
           throws IOException
Passes a set of "answers" to the web service and retrieves a license.

Parameters:
licenseId - The identifier of the license class being requested.
answers - A Map containing the answers to the license fields; each key is the identifier of a LicenseField, with the value containing the user-supplied answer.
lang - The language to request localized elements in.
Throws:
IOException
See Also:
CCLicense, Map

issue

public void issue(String licenseURI)
           throws IOException
Passes a set of "answers" to the web service and retrieves a license.

Parameters:
licenseURI - The uri of the license. Note: does not support localization in 1.5 -- not yet
Throws:
IOException
See Also:
CCLicense, Map

getLicenseUrl

public String getLicenseUrl()
Retrieves the URI for the license issued.

Returns:
A String containing the URI for the license issued.

getLicenseName

public String getLicenseName()
Retrieves the human readable name for the license issued.

Returns:
A String containing the license name.

getLicenseDocument

public org.jdom.Document getLicenseDocument()

getRdf

public String getRdf()
              throws IOException
Throws:
IOException

isSuccess

public boolean isSuccess()

getErrorMessage

public String getErrorMessage()


Copyright © 2011 DuraSpace. All Rights Reserved.