Package org.intocps.maestro.interpreter
Class DefaultExternalValueFactory
java.lang.Object
org.intocps.maestro.interpreter.DefaultExternalValueFactory
- All Implemented Interfaces:
IExternalValueFactory
Default interpreter factory with framework support and other basic features. This class provides run-time support only. It creates and destroys
certain types based on load and unload
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, IValueLifecycleHandler> protected Map<Value, IValueLifecycleHandler> -
Constructor Summary
ConstructorsConstructorDescriptionDefaultExternalValueFactory(File workingDirectory, Function<String, AModuleDeclaration> resolver, InputStream config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleHandler(Class<? extends IValueLifecycleHandler> handlerClass) voidchangeWorkingDirectory(Path newSuggestion, InputStream config) Requests the current factory to return a new instance with the working directory changedCreates a new interpreter value for the specified type using the supplied argumentsDestruction of values created by the factory.booleanCheck if a certain type is supported by the external value factory
-
Field Details
-
lifecycleHandlers
-
values
-
-
Constructor Details
-
DefaultExternalValueFactory
public DefaultExternalValueFactory(File workingDirectory, Function<String, AModuleDeclaration> resolver, InputStream config) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException
-
-
Method Details
-
addLifecycleHandler
public void addLifecycleHandler(Class<? extends IValueLifecycleHandler> handlerClass) throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException -
addLifecycleHandler
-
supports
Description copied from interface:IExternalValueFactoryCheck if a certain type is supported by the external value factory- Specified by:
supportsin interfaceIExternalValueFactory- Parameters:
type-- Returns:
- true if the type is supported by
IExternalValueFactory.create(String, List) - Throws:
Exception
-
create
Description copied from interface:IExternalValueFactoryCreates a new interpreter value for the specified type using the supplied arguments- Specified by:
createin interfaceIExternalValueFactory- Parameters:
loaderName- the type to createargs- the arguments used to create the value- Returns:
- the value or an exception if creation fails
-
destroy
Description copied from interface:IExternalValueFactoryDestruction of values created by the factory. Destruction must make sure all resources hold by this value is freed- Specified by:
destroyin interfaceIExternalValueFactory- Parameters:
value- the value to destroy- Returns:
- void return
-
changeWorkingDirectory
public IExternalValueFactory changeWorkingDirectory(Path newSuggestion, InputStream config) throws IOException, InvocationTargetException, NoSuchMethodException, IllegalAccessException, InstantiationException Description copied from interface:IExternalValueFactoryRequests the current factory to return a new instance with the working directory changed- Specified by:
changeWorkingDirectoryin interfaceIExternalValueFactory- Parameters:
newSuggestion- a suggested path for a new directoryconfig- optionally a new config can be null- Returns:
- a new factory which operates from the suggested path
- Throws:
IOExceptionInvocationTargetExceptionNoSuchMethodExceptionIllegalAccessExceptionInstantiationException
-