forked from project-flogo/flow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.go
61 lines (47 loc) · 1.51 KB
/
extension.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package flow
import (
"github.com/project-flogo/core/data/expression"
"github.com/project-flogo/flow/definition"
"github.com/project-flogo/flow/instance"
"github.com/project-flogo/flow/model"
"github.com/project-flogo/flow/model/simple"
"github.com/project-flogo/flow/support"
"github.com/project-flogo/flow/tester"
)
// Provides the different extension points to the FlowBehavior Action
type ExtensionProvider interface {
GetStateRecorder() instance.StateRecorder
GetFlowTester() *tester.RestEngineTester
GetDefaultFlowModel() *model.FlowModel
GetFlowProvider() definition.Provider
}
//ExtensionProvider is the extension provider for the flow action
type DefaultExtensionProvider struct {
flowProvider definition.Provider
flowModel *model.FlowModel
}
func NewDefaultExtensionProvider() *DefaultExtensionProvider {
return &DefaultExtensionProvider{}
}
func (fp *DefaultExtensionProvider) GetFlowProvider() definition.Provider {
if fp.flowProvider == nil {
fp.flowProvider = &support.BasicRemoteFlowProvider{}
}
return fp.flowProvider
}
func (fp *DefaultExtensionProvider) GetDefaultFlowModel() *model.FlowModel {
if fp.flowModel == nil {
fp.flowModel = simple.New()
}
return fp.flowModel
}
func (fp *DefaultExtensionProvider) GetStateRecorder() instance.StateRecorder {
return nil
}
func (fp *DefaultExtensionProvider) GetScriptExprFactory() expression.Factory {
return nil
}
//todo make FlowTester an interface
func (fp *DefaultExtensionProvider) GetFlowTester() *tester.RestEngineTester {
return nil
}