A Registry/Repository Interface for Synapse

Synapse will offer a registry interface. An implementation of the repository could be something as simple as a website full of XMLs, or a real product registry. For example it could be an SVN repository.

Example usage of the Registry within the Synapse configuration language

Define one or more registries

  <registry name="reg-name" provider="java.class.name for o.a.foo.Registry impl" default="true|false">
    <property name="p1" value=".."/>*
  </registry>

Registry name would be a name local to the Synapse configuration, to refer to something defined within this particular registry. The provider class will implement the Registry interface.

One registry definition can be marked as "default" and if a usage does not explicitly specify the name of a registry, then this will be used by default.

Within a Synapse configuration, you can refer to items defined in the above registry.

e.g.

# 1. Define an endpoint, by looking up an EPR type

  <endpoint name="xxx">
    <lookup-epr key="endpoint-key" [registry="reg-name"]/>
  </endpoint>

This would fetch the endpoint EPR from the registry using the given key. A variation of this would be an inline endpoint definition within a send mediator as follows, which uses the 'To' address of a message to retrieve the EPR of its destination.

  <send>
    <endpoint>
      <lookup-epr key="getProperty('to-address')" [registry="reg-name"]/>
    </endpoint>
  </send>

# 2. Import definitions, by looking up Synapse XML fragments

  <import key="import-key" [registry="reg-name"]/>

This would import a Synapse XML fragment from the registry using the given key. It would be possible to import any valid XML fragment of a Synape configuration. (e.g. sequence, endpoint, property etc.)

The registry would natively support wsdl, xsd, policy and xml, and would be extensible to be able to store any other type of content as well. When a wsdl is imported into the registry, it would fetch all imports such as xsd's and change the references to the local copies.

# 3. Store WSDL, XSD, Policy, XSLT etc for use by Synapse

  <transform xslt|xquery="registry-key" [registry="reg-name"] [source="xpath"]>
    ...
  </transform>

# 4. Lookup a sequence dynamically

<registry-sequence key="getProperty('to-address')" [registry="reg-name"] content-type="synapse/xml"/>

This will lookup a <sequence> in the registry based on a dynamic lookup of the key. This makes it easy to add a new service or flow to a running synapse by publishing in the registry.

Interface

public interface Registry {
 
  public OMElement getResource(String urikey, String contentType, long version);
  public OMElement getResource(String urikey, String contentType);

  public Entry getEntry(String urikey, String contentType, long version);
  public Entry getEntry(String urikey, String contentType);

  public Entry[] getEntries(String uriKey);

}

public interface Entry {

   public String getKey();
   public long getVersion();
   public Date getCreated();
   public Date getLastModified();
   public String getContentType();
   public String getLocation();
}

Synapse/InProgress/Registry (last edited 2009-09-20 23:07:04 by localhost)