Package step.functions.packages
Class FunctionPackageManager
- java.lang.Object
-
- step.functions.packages.FunctionPackageManager
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class FunctionPackageManager extends java.lang.Object implements java.io.Closeable
This class is responsible for the handling ofFunctionPackage
It is responsible for the import ofFunctionPackage
. The import of aFunctionPackage
means:- the persistence of the
FunctionPackage
itself - the definition of the
Function
contained in the package - the registration of change watcher of the package file of the
FunctionPackage
-
-
Constructor Summary
Constructors Constructor Description FunctionPackageManager(FunctionPackageAccessor functionPackageAccessor, FunctionManager functionRepository, ResourceManager resourceManager, FileResolver fileResolver, ch.exense.commons.app.Configuration configuration, ObjectHookRegistry objectHookRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctionPackage
addOrUpdateFunctionPackage(FunctionPackage newFunctionPackage)
Adds or updates aFunctionPackage
This triggers the import or re-import of theFunction
s contained in the packagevoid
close()
FunctionPackage
getFunctionPackage(java.lang.String id)
java.util.List<Function>
getPackageFunctions(java.lang.String functionPackageId)
java.util.List<Function>
getPackagePreview(FunctionPackage functionPackage)
Get the list ofFunction
contained in the provided packagevoid
registerAttributeResolver(java.lang.String key, java.util.function.Function<java.lang.String,java.lang.String> value)
void
registerFunctionPackageHandler(FunctionPackageHandler packageHandler)
Registers aFunctionPackageHandler
FunctionPackage
reloadFunctionPackage(java.lang.String functionPackageId)
Reloads aFunctionPackage
.void
removeFunctionPackage(java.lang.String id)
void
start()
-
-
-
Constructor Detail
-
FunctionPackageManager
public FunctionPackageManager(FunctionPackageAccessor functionPackageAccessor, FunctionManager functionRepository, ResourceManager resourceManager, FileResolver fileResolver, ch.exense.commons.app.Configuration configuration, ObjectHookRegistry objectHookRegistry)
-
-
Method Detail
-
start
public void start()
-
registerFunctionPackageHandler
public void registerFunctionPackageHandler(FunctionPackageHandler packageHandler)
Registers aFunctionPackageHandler
- Parameters:
packageHandler
- the instance of theFunctionPackageHandler
-
registerAttributeResolver
public void registerAttributeResolver(java.lang.String key, java.util.function.Function<java.lang.String,java.lang.String> value)
-
getPackagePreview
public java.util.List<Function> getPackagePreview(FunctionPackage functionPackage) throws java.lang.Exception
Get the list ofFunction
contained in the provided package- Parameters:
functionPackage
- theFunctionPackage
containing functions- Returns:
- the list of
Function
found in theFunctionPackage
- Throws:
java.lang.Exception
- if any error occurs during loading
-
addOrUpdateFunctionPackage
public FunctionPackage addOrUpdateFunctionPackage(FunctionPackage newFunctionPackage) throws java.lang.Exception
Adds or updates aFunctionPackage
This triggers the import or re-import of theFunction
s contained in the package- Parameters:
newFunctionPackage
- theFunctionPackage
to be loaded- Returns:
- the updated
FunctionPackage
- Throws:
java.lang.Exception
- if any error occurs during loading
-
reloadFunctionPackage
public FunctionPackage reloadFunctionPackage(java.lang.String functionPackageId) throws java.lang.Exception
Reloads aFunctionPackage
. This triggers a re-import of theFunction
s contained in the package- Parameters:
functionPackageId
- the ID of theFunctionPackage
to be reloaded- Returns:
- the updated
FunctionPackage
- Throws:
java.lang.Exception
- if any error occurs during reloading
-
getFunctionPackage
public FunctionPackage getFunctionPackage(java.lang.String id)
-
getPackageFunctions
public java.util.List<Function> getPackageFunctions(java.lang.String functionPackageId)
-
removeFunctionPackage
public void removeFunctionPackage(java.lang.String id)
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-