Table of Contents
Overview
Dynamic Configuration allows you to provide various authorization rules for different groups of Citations Helper users. This configuration method requires modifications to the default SiteOsidConfiguration
API implementation, org.sakaiproject.citation.impl.SampleSiteOsidConfiguration
.
Example Scenario
A simple scenario that suggests a dynamic configuration would be appropriate:
At my institution, users affiliated with West Campus use Sirsi SingleSearch, and users affiliated with East Campus use Ex Libris MetaLib.
To handle our example scenario, we'll need two sets of XML configuration files, one for SingleSearch and one for MetaLib, as well as a site-specific implementation of the SiteOsidConfiguration
API interface. The custom SiteOsidConfiguration
implementation selects the appropriate configuration files at runtime, when the Citations Helper is invoked.
API Interface
The Citations code provides a Java interface that defines methods used by the Citations Helper to find appropriate configuration information for a given user. See:
org.sakaiproject.citation.api.SiteOsidConfiguration
Implementations
A SiteOsidConfiguration
implementation picks the proper XML configuration files for the current user, based on that user's context: campus and course affiliations, guest status, etc.
Default Implementation
The default SiteOsidConfiguration
API implementation provided with the Citations Helper is available here:
org.sakaiproject.citation.impl.SampleSiteOsidConfiguration
Essentially, this class makes three decisions:
- Which Sakai properties need to be overridden for this user?
- The Java code returns the name of XML file that describes the proper configuration – return
null
to use the file specified by the following property:configXmlCache@org.sakaiproject.citation.api.ConfigurationService
=<XML file>- The default value for this property is
config.xml
- The default value for this property is
- XML configuration files are discussed below.
- See
getConfigurationXml()
inSampleSiteOsidConfiguration
.
- The Java code returns the name of XML file that describes the proper configuration – return
- Which databases are available to this user?
- The Java code returns the name of an XML file that describes the database hierarchy – return
null
to use the file specified by the following property:databaseXmlCache@org.sakaiproject.citation.api.ConfigurationService
=<XML file>- The default value for this property is
categories.xml
- The default value for this property is
- The Search Categories & Databases XML page has documentation on how to build this XML file.
- See
getDatabaseHierarchyXml()
inSampleSiteOsidConfiguration
.
- The Java code returns the name of an XML file that describes the database hierarchy – return
- What groups (if any) does this user belong to?
- Groups can come into play when the Citation Helper decides which portions of the database hierarchy are available to the current user. In the Search Categories & Databases XML documentation, you will see that each defined database can have associated database-groups.
- See
getGroupIds()
inSampleSiteOsidConfiguration
.
Custom Implementation
A custom (site specific) SiteOsidConfiguration
implementation needs to make the same decisions outlined above.
It may be easiest to modify the default implementation, SampleSiteOsidConfiguration
, with any changes required to address the needs at your site. Your updated code can be compiled and deployed using the normal Citations build procedure.
If you prefer to build a separate class in another location, you can configure the Citations Helper to use this new class by setting the following Sakai property:
osidConfig@org.sakaiproject.citation.api.ConfigurationService
=<full-class-name>
The default value for this property is org.sakaiproject.citation.impl.SampleSiteOsidConfiguration
XML Configuration Files
XML configuration files allow you to provide configuration information for different groups of users. The format of this XML file is very straightforward, simply setting the values of various properties. All of the properties are also Sakai properties that can be set through the sakai.properties
file and that you may have already seen elsewhere in the documentation. Properties set in XML configuration files override those that are set through sakai.properties
. If you want to use certain values from sakai.properties
and override others, only include the properties you would like to override in the XML configuration file.
The following is sample XML configuration file:
<?xml version="1.0" encoding="utf-8"?> <config> <!-- Metasearch engine parameters (URL, username and password) --> <metasearch-baseurl>http://my-institution.edu/web2/servlet/MuseWeb2</metasearch-baseurl> <metasearch-username>my-username</metasearch-username> <metasearch-password>my-password</metasearch-password> <!-- Repository OSID implementation to use --> <!-- edu.indiana.lib.osid.base.repository.http (Sirsi SingleSearch) --> <!-- org.sakaibrary.osid.repository.xserver (Ex Libris MetaLib) --> <osid-impl>org.sakaibrary.osid.repository.xserver</osid-impl> <!-- Google Scholar URL and Sakai server --> <google-baseurl>http://scholar.google.com/schhp</google-baseurl> <sakai-serverkey>my-institution.sakai-instance.edu</sakai-serverkey> <!-- OpenUrl Resolver --> <!-- Use your local resolver URL (if you're running a resolver) --> <!-- http://worldcatlibraries.org/registry/gateway (if you've registered) --> <openurl-resolveraddress>http://my-institution.edu/openurl-resolver</openurl-resolveraddress> </config>
Note: Property names in the XML above are not syntactically the same as the property names used for sakai.properties
. See the Configuration Properties page for a listing of all properties used in sakai.properties
. You will find the property names to be the same, just not written in the same way, as the XML document above.
Note: If there is a conflict between a static and a dynamically set configuration parameter, the dynamic value takes precedence.