## org.eclipse.emf.ecore.resource
Interface Resource.Factory.Registry

All Known Implementing Classes:
  ResourceFactoryRegistryImpl

Enclosing interface:
  Resource.Factory

    public static interface Resource.Factory.Registry

A registry of resource factories.

A registry implementation will typically delegate to the global instance, which can be used as follows

      Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().
        put("abc", resourceFactoryForURIWithAbcProtocol);
      Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().
        put("xyz", resourceFactoryForURIWithXyzFileExtension);

A `descriptor` can be used in place of an actual `factory` as a value in the map. It is used for factories registered via `plugin registration` to ensure delayed plugin load.

Clients must extend the default `implementation`, since methods can and will be added to this API.

See Also:
  `ResourceSet.getResourceFactoryRegistry()`

Field Summary
`static java.lang.String` `DEFAULT_CONTENT_TYPE_IDENTIFIER` The content type identifier `"*"` that matches any content type identifier.
`static java.lang.String` `DEFAULT_EXTENSION` The file extension `"*"` that matches any extension.
`static Resource.Factory.Registry` `INSTANCE` The global static resource factory registry.

Method Summary
`java.util.Map<java.lang.String,java.lang.Object>` `getContentTypeToFactoryMap()` Returns a map from content type identifier to `Resource.Factory` or `Resource.Factory.Descriptor`.
`java.util.Map<java.lang.String,java.lang.Object>` `getExtensionToFactoryMap()` Returns a map from `file extension` to `Resource.Factory` or `Resource.Factory.Descriptor`.
`Resource.Factory` `getFactory(URI uri)` Returns the resource factory appropriate for the given URI.
`Resource.Factory` `getFactory(URI uri, java.lang.String contentType)` Returns the resource factory appropriate for the given URI with the given `content type` identifier.
`java.util.Map<java.lang.String,java.lang.Object>` `getProtocolToFactoryMap()` Returns a map from `protocol` to `Resource.Factory` or `Resource.Factory.Descriptor`.

Field Detail

### DEFAULT_EXTENSION

    static final java.lang.String DEFAULT_EXTENSION

  The file extension `"*"` that matches any extension.

  See Also:
    `getExtensionToFactoryMap()`, Constant Field Values

### DEFAULT_CONTENT_TYPE_IDENTIFIER

    static final java.lang.String DEFAULT_CONTENT_TYPE_IDENTIFIER

  The content type identifier `"*"` that matches any content type identifier.

  See Also:
    `getContentTypeToFactoryMap()`, Constant Field Values

### INSTANCE

    static final Resource.Factory.Registry INSTANCE

  The global static resource factory registry. Registrations made in this instance will (typically) be available for `use` by any resource set.

  See Also:
    `ResourceSet.createResource(URI)`, `ResourceSet.getResourceFactoryRegistry()`

Method Detail

### getFactory

    Resource.Factory getFactory(URI uri)

  Returns the resource factory appropriate for the given URI.

  An implementation will (typically) use the URI's `scheme` to search the `protocol` map the URI's `file extension` to search `extension` map, and the URI's `content type identifier` to search the `content type` map. It will `convert` a resulting descriptor into a factory. It may choose to provide additional mechanisms and algorithms to determine a factory appropriate for the given URI.

  Parameters:
    `uri` - the URI.
  Returns:
    the resource factory appropriate for the given URI, or `null` if there isn't one.
  See Also:
    `ResourceSet.createResource(URI)`

### getFactory

    Resource.Factory getFactory(URI uri,
                                java.lang.String contentType)

  Returns the resource factory appropriate for the given URI with the given `content type` identifier.

  An implementation will (typically) use the URI's `scheme` to search the `protocol` map the URI's `file extension` to search `extension` map, and the given content type identifier to search the `content type` map. It will `convert` a resulting descriptor into a factory. It may choose to provide additional mechanisms and algorithms to determine a factory appropriate for the given URI.

  Parameters:
    `uri` - the URI.
    `contentType` - the content type of the URI or `null` if a content type should not be used during lookup.
  Returns:
    the resource factory appropriate for the given URI with the content content type, or `null` if there isn't one.
  Since:
    2.4
  See Also:
    `ResourceSet.createResource(URI)`

### getProtocolToFactoryMap

    java.util.Map<java.lang.String,java.lang.Object> getProtocolToFactoryMap()

  Returns a map from `protocol` to `Resource.Factory` or `Resource.Factory.Descriptor`.

  Returns:
    the protocol map.

### getExtensionToFactoryMap

    java.util.Map<java.lang.String,java.lang.Object> getExtensionToFactoryMap()

  Returns a map from `file extension` to `Resource.Factory` or `Resource.Factory.Descriptor`.

  The `default` file extension `"*"` can be registered as a default that matches any file extension. This is typically reserved for a default factory that supports XMI serialization; clients are strongly discouraged from using this feature in the global registry, particularly those that must function effectively within an Eclipse environment.

  Returns:
    the file extension map.
  See Also:
    `DEFAULT_EXTENSION`

### getContentTypeToFactoryMap

    java.util.Map<java.lang.String,java.lang.Object> getContentTypeToFactoryMap()

  Returns a map from content type identifier to `Resource.Factory` or `Resource.Factory.Descriptor`.

  The `default` content type identifier `"*"` can be registered as a default that matches any content type identifier. This is typically reserved for a default factory that supports XMI serialization; clients are strongly discouraged from using this feature in the global registry, particularly those that must function effectively within an Eclipse environment.

  Returns:
    the content type identifier map.
  See Also:
    `DEFAULT_CONTENT_TYPE_IDENTIFIER`

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.