Package org.openhab.core.transform
Class AbstractFileTransformationService<T>
java.lang.Object
org.openhab.core.transform.AbstractFileTransformationService<T>
- All Implemented Interfaces:
- TransformationService
@NonNullByDefault
public abstract class AbstractFileTransformationService<T>
extends Object
implements TransformationService
Deprecated.
Base class for cacheable and localizable file based transformation
 
TransformationService.
 It expects the transformation to be applied to be read from a file stored
 under the 'transform' folder within the configuration path. To organize the various
 transformations one might use subfolders.- Author:
- Gaƫl L'hopital - Initial contribution, Kai Kreuzer - File caching mechanism, Markus Rathgeb - Add locale provider support
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static classDeprecated.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionDeprecated.Deprecated.Fields inherited from interface org.openhab.core.transform.TransformationServiceSERVICE_PROPERTY_LABEL, SERVICE_PROPERTY_NAME, TRANSFORM_FOLDER_NAME, TRANSFORM_PROFILE_SCOPE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidactivate(org.osgi.framework.BundleContext context) Deprecated.protected voidDeprecated.getFilenames(String[] validExtensions) Deprecated.Returns a list of all files with the given extensions in the transformation folderprotected LocaleDeprecated.protected StringgetLocalizedProposedFilename(String filename, WatchService watchService) Deprecated.Returns the name of the localized transformation file if it actually exists, keeps the original in the other caseprotected StringDeprecated.Returns the path to the root of the transformation folderprotected abstract TinternalLoadTransform(String filename) Deprecated.Abstract method defined by subclasses to effectively read the transformation source file according to their own needs.protected abstract @Nullable StringinternalTransform(T transform, String source) Deprecated.Abstract method defined by subclasses to effectively operate the transformation according to its rules@Nullable StringDeprecated.Transforms the inputsourceby the according method defined in subclass to another string.
- 
Field Details- 
cachedFilesDeprecated.
- 
watchedDirectoriesDeprecated.
 
- 
- 
Constructor Details- 
AbstractFileTransformationServicepublic AbstractFileTransformationService()Deprecated.
 
- 
- 
Method Details- 
activateprotected void activate(org.osgi.framework.BundleContext context) Deprecated.
- 
deactivateprotected void deactivate()Deprecated.
- 
getLocaleDeprecated.
- 
transformDeprecated.Transforms the input sourceby the according method defined in subclass to another string. It expects the transformation to be read from a file which is stored under the 'conf/transform'- Specified by:
- transformin interface- TransformationService
- Parameters:
- filename- the name of the file which contains the transformation definition. The name may contain subfoldernames as well
- source- the input to transform
- Returns:
- the transformed result or nullif the transformation's output isnull.
- Throws:
- TransformationException
 
- 
internalTransformprotected abstract @Nullable String internalTransform(T transform, String source) throws TransformationException Deprecated.Abstract method defined by subclasses to effectively operate the transformation according to its rules - Parameters:
- transform- transformation held by the file provided to- transformmethod
- source- the input to transform
- Returns:
- the transformed result or null if the transformation couldn't be completed for any reason.
- Throws:
- TransformationException
 
- 
internalLoadTransformDeprecated.Abstract method defined by subclasses to effectively read the transformation source file according to their own needs. - Parameters:
- filename- Name of the file to be read. This filename may have been transposed to a localized one
- Returns:
- An object containing the source file
- Throws:
- TransformationException- file couldn't be read for any reason
 
- 
getLocalizedProposedFilenameDeprecated.Returns the name of the localized transformation file if it actually exists, keeps the original in the other case- Parameters:
- filename- name of the requested transformation file
- Returns:
- original or localized transformation file to use
 
- 
getSourcePathDeprecated.Returns the path to the root of the transformation folder
- 
getFilenamesDeprecated.Returns a list of all files with the given extensions in the transformation folder
 
- 
TransformationRegistryinstead