org.electrocodeogram.cpc.core.api.provider.xml
Interface IMappingRegistry

All Superinterfaces:
IProvider

public interface IMappingRegistry
extends IProvider

A registry which allows easy access to an IMappingProvider which supports a given cpc data mapping.
All IMappingProviders which are registered with the IProviderRegistry are automatically known to this registry. Individual provider priorities are taken into account if multiple providers claim to support a given cpc data mapping.

For convenience reasons the mapping registry also implements part of the IMappingProvider interface.
However, the IMappingProvider is not explicitly extended here, as many of our implementations have different post conditions.

Author:
vw
See Also:
IMappingProvider, IProviderRegistry

Method Summary
 java.lang.String extractCloneObjectUuidFromString(java.lang.String data)
          Extracts the ICloneObject.getUuid() from the main object in the given cpc data string mapping by using the mapping provider with the highest priority which claims to support the given cpc data type.
 IMappingProvider lookupMappingProviderForDataFormat(java.lang.String data)
          Checks whether any of the registered IMappingProviders supports the given cpc data mapping.
 MappingStore mapFromString(java.lang.String data)
          Maps the given cpc data string mapping to a MappingStore using the mapping provider with the highest priority which claims to support the given cpc data type.
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.provider.IProvider
getProviderName, toString
 

Method Detail

lookupMappingProviderForDataFormat

IMappingProvider lookupMappingProviderForDataFormat(java.lang.String data)
Checks whether any of the registered IMappingProviders supports the given cpc data mapping.
The check is based on IMappingProvider.isSupportedMappingFormat(String).
If multiple mapping providers support the given cpc data mapping the one with the highest priority is returned.

Parameters:
data - the cpc data mapping to get a mapping provider for, never null.
Returns:
an IMappingProvider which claims to support the given cpc data mapping or NULL if no corresponding mapping provider could be found.

mapFromString

MappingStore mapFromString(java.lang.String data)
                           throws MappingException
Maps the given cpc data string mapping to a MappingStore using the mapping provider with the highest priority which claims to support the given cpc data type.
Convenience method.
First does a lookupMappingProviderForDataFormat(String) followed by a IMappingProvider.mapFromString(String).
If the initial lookup fails, NULL is returned.

Parameters:
data - the cpc data mapping to convert, never null.
Returns:
a valid MappingStore if an IMappingProvider could be found for the given cpc data mapping, NULL otherwise.
Throws:
MappingException - passed through from IMappingProvider.mapFromString(String).
See Also:
lookupMappingProviderForDataFormat(String), IMappingProvider.mapFromString(String)

extractCloneObjectUuidFromString

java.lang.String extractCloneObjectUuidFromString(java.lang.String data)
                                                  throws MappingException
Extracts the ICloneObject.getUuid() from the main object in the given cpc data string mapping by using the mapping provider with the highest priority which claims to support the given cpc data type.
Convenience method.
First does a lookupMappingProviderForDataFormat(String) followed by a IMappingProvider.extractCloneObjectUuidFromString(String).
If the initial lookup fails, NULL is returned.

Parameters:
data - the cpc data mapping to extract the main entries UUID from, never null.
Returns:
the UUID of the main ICloneObject entry in the given mapping or NULL. See IMappingProvider.extractCloneObjectUuidFromString(String).
Throws:
MappingException - passed through from IMappingProvider.extractCloneObjectUuidFromString(String).
See Also:
lookupMappingProviderForDataFormat(String), IMappingProvider.extractCloneObjectUuidFromString(String)