Click or drag to resize
IFileTypeManager Interface

This is the main access point for file conversion operations.

The file type manager holds a prioritized list of file type definitions. The order of file type definitions is important, as it determines which file types take precedence over others in case multiple file type definitions could be used to process the same file. The most significant file type definition appears first in the list.

In implementations, the file type manager is often pre-configured with a set of file type definitions in the host application. However, the list can also be explicitly manipulated by calling AddFileTypeDefinition(IFileTypeDefinition), InsertFileTypeDefinition(Int32, IFileTypeDefinition) or RemoveFileTypeDefinition(IFileTypeDefinition). File type definitions can be instantiated from existing files or resources using the FileTypeDefinitionFactory.

Call one of the overloaded GetConverter...() methods to use the file type definitions to automatically detect file types and initialize a IMultiFileConverter to process the content.

Namespace: Sdl.FileTypeSupport.Framework.IntegrationApi
Assembly: Sdl.FileTypeSupport.Framework.Core (in Sdl.FileTypeSupport.Framework.Core.dll) Version: 1.0.0.0 (1.0.2551.0)
Syntax
public interface IFileTypeManager

The IFileTypeManager type exposes the following members.

Properties
  NameDescription
Public propertyAutoLoadedFileTypes
Gets a list of filetypes which should be auto-loaded by the Host. This is used to indicate new file types in this particular version of the FileTypeManager
Public propertyConfigurationVersionInformation

Provides information on the version of the configuration information that is used to instantiate the current instance of the IFileTypeManager. This can be used to determine whether the instance is working with the latest version of configuration information that the host application requires.

For instance, applications may transfer their file type manager configuration information from one system to another. By checking this property the application can determine the state of the configuration, and perform additional tasks to ensure the configuration is in the format that the application requires (e.g. deploy additional filters that have only been released in the latest version of the application).

Public propertyDefaultBilingualFileTypeDefinition
The file type definitions that should be used as the default bilingual file type, or null if none.
Public propertyFileTypeDefinitionFactory
Provides access to the implementation used to instantiate file type definitions. Can be used to explicitly create a file type definition that can be added to the manager by calling AddFileTypeDefinition(IFileTypeDefinition) or InsertFileTypeDefinition(Int32, IFileTypeDefinition).
Public propertyFileTypeDefinitions

The file type definitions that are currently known to this instance of the file type manager.

The order of the file type definitions defines their relative priority, with the most significant file type definition appearing first.

Public propertySettingsBundle
The settings bundle containing the settings used by components of the FileTypeManager. This property should be set before any operations requiring the use of settings are invoked (for example, GetConverterToBilingual implementations) or the operation may not work as expected. This property can return null if no settings bundle has been set.
Top
Methods
  NameDescription
Public methodAddFileTypeDefinition
Appends a file type definition to the collection.
Public methodBuildAdditionalGeneratorsInfo
Helper method to create additional generator information so that it can be used by filter component builders.
Public methodBuildBilingualGenerator(IBilingualDocumentWriter)
Helper function to create a bilingual generator for a bilingual document writer, so that it can be used with relevant overloads to GetConverter.
Public methodBuildBilingualGenerator(IFileTypeDefinition)
Helper function used by the file type manager implementation and other components that need to instantiate a bilingual generator for a specific file type.
Public methodBuildDefaultBilingualGenerator
Helper function that constructs an instance of a generator for the default bilingual file format, if set.
Public methodBuildExtractor
Helper function used by the file type manager implementation and other components that need to create components that are normally used through the file converters objects.

Determines the best matching file type for the specified file according to the rules described in the documentation of GetConverter(String, CultureInfo, Codepage, EventHandlerMessageEventArgs) and returns an initialized file extractor that can be used to process the file.

Public methodBuildFileExtractor(IBilingualParser, IFileTypeComponentBuilder)
Helper method to create a file extractor so that it can be used by filter component builders.
Public methodBuildFileExtractor(INativeExtractor, IFileTypeComponentBuilder)
Helper method to create a file extractor so that it can be used by filter component builders.
Public methodBuildFileGenerator(IBilingualWriter)
Helper method to create a file generator so that it can be used by filter component builders.
Public methodBuildFileGenerator(INativeGenerator)
Helper method to create a file generator so that it can be used by filter component builders.
Public methodBuildFileTypeInformation
Helper method to create file type information so that it can be used by filter component builders.
Public methodBuildGeneratorInfo
Helper method to create generator information so that it can be used by filter component builders.
Public methodBuildNativeExtractor
Helper method to create a native extractor so that it can be used by filter component builders.
Public methodBuildNativeGenerator(INativeFileWriter)
Helper method to create a native generator so that it can be used by filter component builders.
Public methodBuildNativeGenerator(IPersistentFileConversionProperties)
Helper function used by the file type manager implementation and other components that need to create a file generator component from a specific file type definition.

Creates and initializes a file generator that can be used to write native output files.

Public methodBuildNativeGeneratorWithVerifiers
This is an alternative implementation of the BuildNativeGenerator(IPersistentFileConversionProperties) method, which creates a generator with objects that will perform native verification of the generated file.
Public methodBuildNativeSubContentExtractor
Helper method to create a native sub-content extractor so that it can be used by filter component builders.
Public methodBuildNativeSubContentGenerator
Helper method to create a native sub content generator so that it can be used by filter component builders.
Public methodBuildPreviewSetsFactory
Helper method to create a preview sets factory so that it can be used by filter compnent builders.
Public methodBuildQuickTagsFactory
Helper method to create a QuickTags factory so that it can be used by filter component builders.
Public methodBuildSubContentExtractor(IBilingualParser, IFileTypeComponentBuilder)
Helper method to create a sub-content extractor so that it can be used by filter component builders.
Public methodBuildSubContentExtractor(INativeSubContentExtractor, IFileTypeComponentBuilder)
Helper method to create a sub-content file extractor so that it can be used by filter component builders.
Public methodBuildSubContentGenerator(IBilingualWriter)
Helper method to create a sub content generator so that it can be used by filter component builders.
Public methodBuildSubContentGenerator(INativeSubContentGenerator)
Helper method to create a sub content generator so that it can be used by filter component builders.
Public methodBuildVerifierCollection
Helper method to create a verifier collection so that it can be used by filter component builders.
Public methodClearFileTypeDefinitions
Removes all file type definitions from the collection.
Public methodCreateFileTypeDefinition(String)
Creates a file type definition based on the filter definition ID of component builder which should be used to create this filter.
Public methodCreateFileTypeDefinition(String, FileTypeProfile)
Creates a file type definition based on the Id and a profile override. The FilterManager must discover the actual component builder associated with this definition and create a new definition based on it. If a profileOverride has been supplied, then this should override the FileTypeInformation for that definition.
Public methodCreateFileTypeDefinition(IFileTypeComponentBuilder, FileTypeProfile)
Creates a file type definition based on component builder and overrides the FileTypeInformation with the supplied profile override.
Public methodFindFileTypeDefinition
Locates a file type definition from the collection using ids.
Public methodGetAllMatchingFileTypeDefinitions

Returns the file type definitions that can operate on the specified file.

Each file type definition is evaluated in order to determine if it can process the file, which may involve invoking the corresponding file sniffer.

Only file type definitions that are enabled and not hidden are evaluated.

Public methodGetConverter(IBilingualParser)
Creates and initializes a file converter to use a specific bilingual parser, and not output to anything in particular.
Public methodGetConverter(String, EventHandlerMessageEventArgs)
Creates and initializes a file converter that can be used to read a single bilingual file, without outputting content to anything in particular.
Public methodGetConverter(String, CultureInfo, Codepage, EventHandlerMessageEventArgs)
Creates and initializes a file converter for reading native files, without passing the output to anything.
Public methodGetConverterToBilingual(IBilingualParser, IBilingualDocumentGenerator, BilingualDocumentOutputPropertiesProvider)
Creates and initializes a file converter for an existing bilingual parser and writer.
Public methodGetConverterToBilingual(String, IBilingualDocumentGenerator, BilingualDocumentOutputPropertiesProvider, EventHandlerMessageEventArgs)
Creates and initializes a file converter for a single file, typically of the default bilingual file type. The specified bilingual document generator will be used for output. The file type definitions are tested in order, and the first file type definition that matches the input file is used. The following steps are used to determine if a file type definition matches the file:
  1. The regular expression is evaluated against the name of the file to be converted. If it does not match, the file type definition is not used.
  2. If a file sniffer is defined for the file type definition, it gets applied to the file. If the file sniffer does not indicate that the file is supported, the file type definition is not used.
If no matching file type definition is found, a OneOrMoreFilesNotSupportedException is thrown.
Public methodGetConverterToBilingual(String, IBilingualDocumentGenerator, BilingualDocumentOutputPropertiesProvider, CultureInfo, Codepage, EventHandlerMessageEventArgs)
Creates and initializes a file converter using the filters that best match a set of native files. The file converter can then be used to process all of the files as one document. The specified bilingual writer will be used for output. The file type definitions are tested in sequence, and the first file type definition that matches a file is used for each file. The following steps are used to determine if a file type definition matches a file:
  1. The regular expression is evaluated against the name of the file to be converted. If it does not match, the file type definition is not used.
  2. If a file sniffer is defined for the file type definition, it gets applied to the file. If the file sniffer does not indicate that the file is supported, the file type definition is not used.
If no matching file type definition is found, a OneOrMoreFilesNotSupportedException is thrown.
Public methodGetConverterToDefaultBilingual(IBilingualParser, String)
Creates and initializes a file converter to write a bilingual output file in the default format, reading input from a specified bilingual parser.
Public methodGetConverterToDefaultBilingual(String, String, EventHandlerMessageEventArgs)
Creates and initializes a file converter in order to read a single (typically bilingual) input file and write a bilingual output file in the default format.

The converter will automatically use the file type that best matches the file to be converted.

The file type definitions are each tested in sequence, and the first file type definition that matches the input file is used. The following steps are used to determine if a file type definition matches:

  1. The regular expression is evaluated against the name of the file to be converted. If it does not match, the file type definition is not used.
  2. If a file sniffer is defined for the file type definition, it is applied to the file. If the file sniffer does not indicate that the file is supported, the file type definition is not used.
If no matching file type definition is found, a OneOrMoreFilesNotSupportedException is thrown.
Public methodCode exampleGetConverterToDefaultBilingual(String, String, CultureInfo, Codepage, EventHandlerMessageEventArgs)
Creates and initializes a file converter in order to create a bilingual file in the default format.

The converter will automatically use the filters that best match the native files to be converted. These converters are selected as described below.

The file type definitions are each tested in sequence, and the first file type definition that matches a file is used for each file. The following steps are used to determine if a file type definition matches a file:

  1. The regular expression is evaluated against the name of the file to be converted. If it does not match, the file type definition is not used.
  2. If a file sniffer is defined for the file type definition, it is applied to the file. If the file sniffer does not indicate that the file is supported, the file type definition is not used.
If no matching file type definition is found, a OneOrMoreFilesNotSupportedException is thrown.
Public methodGetConverterToNative(IBilingualParser, OutputPropertiesProvider)
Creates a converter for writing native output files for content read by a specified bilingual parser.
Public methodCode exampleGetConverterToNative(String, OutputPropertiesProvider, EventHandlerMessageEventArgs)
Creates a converter for parsing a single file and writing native output files.

This is intended for bilingual file types, in which the languages and codepage can be deducted automatically from the file content.

This version is typically used for parsing SDL XLIFF documents (where support for these have been installed as another bilingual file type). However, it could also be used for processing individual native files in which source language (and codepage) can be deducted from the file content.

Public methodGetConverterToNative(String, OutputPropertiesProvider, CultureInfo, Codepage, EventHandlerMessageEventArgs)
Creates and initializes a file converter for reading native files, doing processing on them and creating native files as output in one single pass.

The file type definitions are tested in sequence, and the first file type definition that matches a file is used for each file. The following steps are used to determine if a file type definition matches a file:

  1. The regular expression is evaluated against the name of the file to be converted. If it does not match, the file type definition is not used.
  2. If a file sniffer is defined for the file type definition, it is applied to the file. If the file sniffer does not indicate that the file is supported, the file type definition is not used.
If no matching file type definition is found, a OneOrMoreFilesNotSupportedException is thrown.
Public methodInsertFileTypeDefinition
Inserts a file type definition into the collection at a specific priority position.
Public methodRemoveFileTypeDefinition
Removes a file type definition from the collection. If no such file type definition exists in the collection, nothing happens.
Top
Remarks

Actual file type manager instances are often provided by the application that hosts the framework, in which case they are often pre-configured from some configuration (e.g. through the spring framework).

See Also
Community
Edit

Be the first to Edit the community content of this topic.
Comments