-
Notifications
You must be signed in to change notification settings - Fork 54
/
legacy.go
56 lines (43 loc) · 1.09 KB
/
legacy.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
package activity
import (
"fmt"
"github.com/project-flogo/core/support/log"
)
type void struct{}
var (
hasLegacy = false
empty void
legacyTracker = make(map[string]void)
)
//DEPRECATED
func HasLegacyActivities() bool {
return hasLegacy
}
//DEPRECATED
func IsLegacyActivity(ref string) bool {
_, ok := legacyTracker[ref]
return ok
}
//DEPRECATED
func LegacyRegister(ref string, activity Activity) error {
if ref == "" {
return fmt.Errorf("'ref' must be specified when registering")
}
if activity == nil {
return fmt.Errorf("cannot register 'nil' activity")
}
if _, dup := activities[ref]; dup {
return fmt.Errorf("activity already registered: %s", ref)
}
log.RootLogger().Debugf("Registering legacy activity: %s", ref)
hasLegacy = true
activities[ref] = activity
legacyTracker[ref] = empty
activityLoggers[ref] = log.CreateLoggerFromRef(rootLogger, "activity", ref)
return nil
}
type LegacyCtx interface {
// GetOutput gets the value of the specified output attribute
GetOutput(name string) interface{}
GetSetting(name string) (value interface{}, exists bool)
}