org.eclipse.emf.ecore.resource.impl
Class ResourceFactoryRegistryImpl

java.lang.Object
  extended by org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl
All Implemented Interfaces:
Resource.Factory.Registry

public class ResourceFactoryRegistryImpl
extends java.lang.Object
implements Resource.Factory.Registry

An extensible implementation of a resource factory registry.


Field Summary
protected static java.util.Map<?,?> CONTENT_DESCRIPTION_OPTIONS
          A constant read only map of options used to request just the content type.
protected  java.util.Map<java.lang.String,java.lang.Object> contentTypeIdentifierToFactoryMap
          The content type identifier map.
protected  java.util.Map<java.lang.String,java.lang.Object> extensionToFactoryMap
          The extension map.
protected  java.util.Map<java.lang.String,java.lang.Object> protocolToFactoryMap
          The protocol map.
 
Fields inherited from interface org.eclipse.emf.ecore.resource.Resource.Factory.Registry
DEFAULT_CONTENT_TYPE_IDENTIFIER, DEFAULT_EXTENSION, INSTANCE
 
Constructor Summary
ResourceFactoryRegistryImpl()
          Creates an instance.
 
Method Summary
static Resource.Factory convert(java.lang.Object resourceFactory)
           
protected  Resource.Factory delegatedGetFactory(URI uri)
          Deprecated. since 2.4
protected  Resource.Factory delegatedGetFactory(URI uri, java.lang.String contentTypeIdentifier)
          Returns the resource factory appropriate for the given URI and content type identifier, when standard alternatives fail.
protected  java.util.Map<?,?> getContentDescriptionOptions()
          Returns the default options used to compute the content type identifier.
protected  java.lang.String getContentTypeIdentifier(URI uri)
           
 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.
protected  java.lang.Object getFactory(URI uri, java.util.Map<java.lang.String,java.lang.Object> protocolToFactoryMap, java.util.Map<java.lang.String,java.lang.Object> extensionToFactoryMap, java.util.Map<java.lang.String,java.lang.Object> contentTypeIdentifierToFactoryMap, java.lang.String contentTypeIdentifier, boolean delegate)
           
 Resource.Factory getFactory(URI uri, java.lang.String contentType)
          Returns the resource factory appropriate for the given URI.
 java.util.Map<java.lang.String,java.lang.Object> getProtocolToFactoryMap()
          Returns a map from protocol to Resource.Factory or Resource.Factory.Descriptor.
protected  URIConverter getURIConverter()
          Returns the URI converter that's used to compute the content type identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protocolToFactoryMap

protected java.util.Map<java.lang.String,java.lang.Object> protocolToFactoryMap
The protocol map.


extensionToFactoryMap

protected java.util.Map<java.lang.String,java.lang.Object> extensionToFactoryMap
The extension map.


contentTypeIdentifierToFactoryMap

protected java.util.Map<java.lang.String,java.lang.Object> contentTypeIdentifierToFactoryMap
The content type identifier map.


CONTENT_DESCRIPTION_OPTIONS

protected static final java.util.Map<?,?> CONTENT_DESCRIPTION_OPTIONS
A constant read only map of options used to request just the content type.

Constructor Detail

ResourceFactoryRegistryImpl

public ResourceFactoryRegistryImpl()
Creates an instance.

Method Detail

getFactory

public Resource.Factory getFactory(URI uri)
Returns the resource factory appropriate for the given URI.

This implementation does the typical thing. It will delegate to delegatedGetFactory(URI, String) in the case that the typical behaviour doesn't produce a result; clients are encouraged to override that method only.

Specified by:
getFactory in interface Resource.Factory.Registry
Parameters:
uri - the URI.
Returns:
the resource factory appropriate for the given URI.
See Also:
ResourceSet.createResource(URI)

getFactory

public Resource.Factory getFactory(URI uri,
                                   java.lang.String contentType)
Returns the resource factory appropriate for the given URI.

This implementation does the typical thing. It will delegate to delegatedGetFactory(URI, String) in the case that the typical behaviour doesn't produce a result; clients are encouraged to override that method only.

Specified by:
getFactory in interface Resource.Factory.Registry
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.
See Also:
ResourceSet.createResource(URI)

convert

public static Resource.Factory convert(java.lang.Object resourceFactory)

getFactory

protected java.lang.Object getFactory(URI uri,
                                      java.util.Map<java.lang.String,java.lang.Object> protocolToFactoryMap,
                                      java.util.Map<java.lang.String,java.lang.Object> extensionToFactoryMap,
                                      java.util.Map<java.lang.String,java.lang.Object> contentTypeIdentifierToFactoryMap,
                                      java.lang.String contentTypeIdentifier,
                                      boolean delegate)

getContentTypeIdentifier

protected java.lang.String getContentTypeIdentifier(URI uri)

getURIConverter

protected URIConverter getURIConverter()
Returns the URI converter that's used to compute the content type identifier.

Returns:
the URI converter that's used to compute the content type identifier.

getContentDescriptionOptions

protected java.util.Map<?,?> getContentDescriptionOptions()
Returns the default options used to compute the content type identifier.

Returns:
the default options used to compute the content type identifier.

delegatedGetFactory

protected Resource.Factory delegatedGetFactory(URI uri,
                                               java.lang.String contentTypeIdentifier)
Returns the resource factory appropriate for the given URI and content type identifier, when standard alternatives fail.

This implementation calls delegatedGetFactory(URI); clients are encouraged to override it.

Parameters:
uri - the URI.
contentTypeIdentifier - the content type identifier.
Returns:
the resource factory appropriate for the given URI and content type identifier.
See Also:
getFactory(URI)

delegatedGetFactory

@Deprecated
protected Resource.Factory delegatedGetFactory(URI uri)
Deprecated. since 2.4

Returns the resource factory appropriate for the given URI, when standard alternatives fail.

This implementation returns null; clients are encouraged to override delegatedGetFactory(URI, String) instead.

Parameters:
uri - the URI.
Returns:
the resource factory appropriate for the given URI.
See Also:
getFactory(URI)

getExtensionToFactoryMap

public java.util.Map<java.lang.String,java.lang.Object> getExtensionToFactoryMap()
Description copied from interface: Resource.Factory.Registry
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.

Specified by:
getExtensionToFactoryMap in interface Resource.Factory.Registry
Returns:
the file extension map.
See Also:
Resource.Factory.Registry.DEFAULT_EXTENSION

getProtocolToFactoryMap

public java.util.Map<java.lang.String,java.lang.Object> getProtocolToFactoryMap()
Description copied from interface: Resource.Factory.Registry
Returns a map from protocol to Resource.Factory or Resource.Factory.Descriptor.

Specified by:
getProtocolToFactoryMap in interface Resource.Factory.Registry
Returns:
the protocol map.

getContentTypeToFactoryMap

public java.util.Map<java.lang.String,java.lang.Object> getContentTypeToFactoryMap()
Description copied from interface: Resource.Factory.Registry
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.

Specified by:
getContentTypeToFactoryMap in interface Resource.Factory.Registry
Returns:
the content type identifier map.
See Also:
Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER

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