Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "XML File CP Configuration"

(File Format)
(Configuration)
Line 51: Line 51:
 
           when a new context is instantiated. -->
 
           when a new context is instantiated. -->
  
       <Setting Name="XmlFileName" Type="xsd:string">/srv/www/htdocs/mydata.xml</Setting>   <!-- Name of XML file that holds the data -->
+
       <Setting Name="XmlFileName" Type="xsd:string">/somedir/somefile.xml</Setting>       <!-- Name of XML file that holds the data -->
 
       <Setting Name="XmlFileAdminUser" Type="xsd:string">admin</Setting>                  <!-- Name of user to create if the file must be created -->
 
       <Setting Name="XmlFileAdminUser" Type="xsd:string">admin</Setting>                  <!-- Name of user to create if the file must be created -->
 
       <Setting Name="XmlFileAdminPassword" Type="xsd:string">adminpassword</Setting>      <!-- Password of user to create if the file is created -->
 
       <Setting Name="XmlFileAdminPassword" Type="xsd:string">adminpassword</Setting>      <!-- Password of user to create if the file is created -->

Revision as of 13:25, 13 December 2007

Configuration

The XML File Context Provider uses an XML file for configuration. The general format of this XML file is defined here: Higgins XML Component Configuration. This configuration is expected to be part of an XRDS document as described here: Higgins Context Discovery Components.

It may also be included in the settings for the IdAS registry. In the configuration for the IdAS registry, there are several settings that must be specified. These are illustrated below (see inline comments for explanations). The settings map that ends up being passed into an instance of the XML file context provider is defined under the ContextIdsList setting, under the particular context ID that is for the XML file context provider - in this case, it is the "urn:XMLFILE" setting under the "ContextIdsList" setting. The other settings illustrated here are for the IdAS registry so it can know how to find a context ID and then what factory to use to instantiate the right context provider for that context ID.


<!-- Settings that will be passed into the context factory instances -->

<Setting Name="ComponentSettings" Type="htf:map">
   <Setting Name="XMLFileContextFactory" Type="htf:map"/>
</Setting>

<!-- Factory for instantiating the XML File context provider.  It has no special settings (see above) -->

<Setting Name="XMLFileContextFactory" Type="htf:classinstance">org.eclipse.higgins.idas.cp.xmlfile.NonsharedContextFactory</Setting>

<!-- List of factories supported by the IdAS registry -->

<Setting Name="ContextFactoryInstancesList" Type="htf:list">
   <Setting Name="XMLFileContextFactory" Type="htf:map">
      <Setting Name="Instance" Type="xsd:string">XMLFileContextFactory</Setting>
      <Setting Name="ContextTypes" Type="htf:list">
         <Setting Name="XMLFileContextType" Type="xsd:string">$context+xmlfile</Setting>
      </Setting>
   </Setting>
</Setting>

<!-- The IdAS registry setting that defines the list of context IDs.  In this list, we have shown a context ID that uses
     the XML File context provider -->

<Setting Name="ContextIdsList" Type="htf:list">
   <Setting Name="urn:XMLFILE" Type="htf:map">

      <!-- This defines the Context ID.  The name must be a valid URI -->

      <Setting Name="ContextId" Type="xsd:string">urn:XMLFILE</Setting>

      <!-- This is the list of context types this context supports.  The setting name "XMLFileContextType" will associate it
           with the factory that is defined above -->

      <Setting Name="ContextTypes" Type="htf:list">
         <Setting Name="XMLFileContextType" Type="xsd:string">$context+xmlfile</Setting>
      </Setting>
      <Setting Name="ContextUris" Type="htf:list">
         <Setting Name="DefaultContextUri" Type="xsd:anyURI">urn:XMLFILE</Setting>
      </Setting>

      <!-- These are the settings that the XML File Context Provider cares about.  These settings are passed into the context provider
           when a new context is instantiated. -->

      <Setting Name="XmlFileName" Type="xsd:string">/somedir/somefile.xml</Setting>        <!-- Name of XML file that holds the data -->
      <Setting Name="XmlFileAdminUser" Type="xsd:string">admin</Setting>                   <!-- Name of user to create if the file must be created -->
      <Setting Name="XmlFileAdminPassword" Type="xsd:string">adminpassword</Setting>       <!-- Password of user to create if the file is created -->
   </Setting>
</Setting>

File Format

The XML file context provider detects when the XML file has been edited outside of IdAS (using a text editor for example), and automatically refreshes its data for the provider. It is anticipated that some users will find a text editor to be the easiest method for making changes to the data, although the IdAS update methods are nearly all supported. The file format is very simple. It is illustrated below (see the inline comments for explanations):

<?xml version="1.0" encoding="UTF-8"?>
<Context>

   <!-- The context provider needs to know the attribute IDs for three attributes: user name, password, and card key hash -->

   <UserNameAttrID>http://www.eclipse.org/higgins/ontologies/2006/higgins#userName</UserNameAttrID>
   <PasswordAttrID>http://www.eclipse.org/higgins/ontologies/2006/higgins#password</PasswordAttrID>
   <CardKeyHashAttrID>http://www.eclipse.org/higgins/ontologies/2006/higgins/higgins#cardKeyHash</CardKeyHashAttrID>\

   <!-- Digital subjects are defined by the DigitalSubject element.  The SubjectType attribute specifies the type of the digital subject -->

   <DigitalSubject SubjectType="http://www.eclipse.org/higgins/ontologies/2006/person#Person">

      <!-- Attributes are defined by the Attribute element.  The AttrID attribute specifies the type of the attribute.  The DataType
           attribute specifies the data type for the attribute values.  Note that the context provider determines if an attribute is
           simple or not by the DataType attribute.  These are basically the well known types defined in the idas.spi.ITypedValue interface. -->

      <Attribute AttrID="http://www.eclipse.org/higgins/ontologies/2006/higgins#userName" DataType="http://www.w3.org/2001/XMLSchema#string">

         <!-- Attribute values are defined by the AttributeValue element.  Simple attribute values are stored directly in the element.  Complex
              attribute values will have a sequence of nested Attribute elements -->

         <AttributeValue>admin</AttributeValue>
      </Attribute>

      <Attribute AttrID="http://www.eclipse.org/higgins/ontologies/2006/higgins#password" DataType="http://www.w3.org/2001/XMLSchema#string">
         <AttributeValue>adminpassword</AttributeValue>
      </Attribute>
   </DigitalSubject>
</Context>

See Also

Back to the top