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 "Context Discovery Components Without XRDS"

(Example)
Line 35: Line 35:
  
 
== Example ==
 
== Example ==
 +
 +
This is a sample configuration file that contains configuration for both context factories and contexts.
  
 
(Thanks to Jim, Mike, Daniel for writing the example, this helps a lot)
 
(Thanks to Jim, Mike, Daniel for writing the example, this helps a lot)

Revision as of 18:01, 2 October 2007

About

This page outlines a proposed alternative way to perform two core services of the IdASRegistry, which are "normally" handled using XRDS documents (as described in ContextDiscoveryComponents)

On this page, "normal" means the XRDS way, whereas "alternative" means the Configuration API way, as described on this page. (Markus: Sorry for calling the XRDS way the "normal" one, it helps me write this page :) ).

These two services are:

  1. Configuration and registration of context factories
  2. Configuration of contexts

The goal is to make both possible without requiring XRDS documents. The proposed way of doing this is to use the Configuration API. This means that IdASRegistry will become an IConfigurableComponent. The map passed to its configure() method will contain the information that is "normally" found in XRDS documents.

Configuration and registration of context factories

As described in ContextDiscoveryComponents, this "normally" happens by looking into an XRDS document (by default a local file called "contextfactories.xrds").

The proposed alternative way is that this is also becomes possible by including a list of context factories (and their context types) in the map passed to IdASRegistry's configure() method.

Both ways can be combined. The IdASRegistry will then "know" all context factories from the XRDS document, and all context factories obtained through the Configuration API.

There is also a "manual" way to register context factories: The registerContextFactory() methods.

Configuration of contexts

Configuring and instantiating contexts involves a context ID.

A context ID somehow can be used to obtain one or more context types, and context configuration. The context type is used to find a suitable context factory. In the "normal" way, a context ID can be an XRI, URI or a local XRDS document. From that document the necessary information is read.

The proposed alternative way is that the map passed to IdASRegistry's configure() method contains a list (called "ContextConfiguration" in the example). Each entry in the list contains a context ID, plus the usual information (context types and context configuration). These context IDs can then be used just like the "normal" XRDS-based ones, e.g. in the IdASRegistry.createContext(contextID) method.

Like before, both ways can be combined. The IdASRegistry will be able to "resolve" context IDs from the "normal" way (i.e. XRIs, URIs, and local XRDS documents), but it will also "know" the context IDs obtained through the Configuration API.

It is also proposed to add a "manual" way to register context IDs (e.g. a method called registerContextId), which would take as parameters a context ID (String), one or more context types (String[]) and context configuration (Map).

Example

This is a sample configuration file that contains configuration for both context factories and contexts.

(Thanks to Jim, Mike, Daniel for writing the example, this helps a lot)


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

   <Setting Name="JNDIContextFactory" Type="htf:map">
      <Setting Name="ContextTypes" Type="htf:list">
         <Setting Name="ContextType1" Type="xsd:string">$context+jndi+ldap</Setting>
         <Setting Name="ContextType2" Type="xsd:string">$context+jndi+file</Setting>
      </Setting>
   </Setting>

   <Setting Name="ODBCContextFactory" Type="htf:map">
      <Setting Name="ContextTypes" Type="htf:list">
         <Setting Name="ContextType" Type="xsd:string">$context+odbc</Setting>
      </Setting>
   </Setting>

   <Setting Name="IdentityAttributeService" Type="htf:map">
      <Setting Name="ContextFactoryInstanceList" Type="htf:list">
         <Setting Name="ContextFactory1" Type="xsd:string">JNDIContextFactory</Setting>
         <Setting Name="ContextFactory2" Type="xsd:string">ODBCContextFactory</Setting>
      </Setting>
      <Setting Name="ContextConfigurations" Type="htf:list">
         <Setting Name="ContextConfig1" Type="htf:map">
         <Setting Name="ContextId" Type="xsd:string">Jim's Context</Setting>
            <Setting Name="ContextType" Type="xsd:string">$context+jndi+ldap</Setting>
            ... (Context-specific config data here) ...
         </Setting>
         <Setting Name="ContextConfig2" Type="htf:map">
            <Setting Name="ContextId" Type="xsd:string">Markus' Context</Setting>
            <Setting Name="ContextType" Type="xsd:string">$context+jndi+file</Setting>
            ... (Context-specific config data here) ...
         </Setting>
         <Setting Name="ContextConfig3" Type="htf:map">
            <Setting Name="ContextId" Type="xsd:string">Mike's Context</Setting>
            <Setting Name="ContextType" Type="xsd:string">$context+odbc</Setting>
            ... (Context-specific config data here) ...
         </Setting>
      </Setting>
   </Setting>
  </Setting>
 
  <Setting Name="JNDIContextFactory" Type="htf:instance">org.eclipse.higgins.idas.cp.jndi.JNDIContextFactory</Setting>

  <Setting Name="ODBCContextFactory" Type="htf:instance">org.eclipse.higgins.idas.cp.odbc.ODBCContextFactory</Setting>
 
  <Setting Name="IdentityAttributeService" Type="htf:singleton">org.eclipse.higgins.idas.registry.IdASRegistry</Setting>

Back to the top