|
1
|
|
|
from niprov.config import Configuration |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
class Dependencies(object): |
|
5
|
|
|
|
|
6
|
|
|
def __init__(self, config=None): |
|
7
|
|
|
if config is None: |
|
8
|
|
|
config = Configuration() |
|
9
|
|
|
self.config = config |
|
10
|
|
|
|
|
11
|
|
|
def reconfigureOrGetConfiguration(self, newConfiguration): |
|
12
|
|
|
if newConfiguration is not None: |
|
13
|
|
|
self.config = newConfiguration |
|
14
|
|
|
return self.config |
|
15
|
|
|
|
|
16
|
|
|
def getClock(self): |
|
17
|
|
|
import niprov.clock |
|
18
|
|
|
return niprov.clock.Clock() |
|
19
|
|
|
|
|
20
|
|
|
def getConfiguration(self): |
|
21
|
|
|
return self.config |
|
22
|
|
|
|
|
23
|
|
|
def getExternals(self): |
|
24
|
|
|
import niprov.externals |
|
25
|
|
|
return niprov.externals.Externals() |
|
26
|
|
|
|
|
27
|
|
|
def getFileFactory(self): |
|
28
|
|
|
import niprov.files |
|
29
|
|
|
return niprov.files.FileFactory(dependencies=self) |
|
30
|
|
|
|
|
31
|
|
|
def getFileFilter(self): |
|
32
|
|
|
import niprov.filefilter |
|
33
|
|
|
return niprov.filefilter.FileFilter(dependencies=self) |
|
34
|
|
|
|
|
35
|
|
|
def getFilesystem(self): |
|
36
|
|
|
import niprov.filesystem |
|
37
|
|
|
return niprov.filesystem.Filesystem() |
|
38
|
|
|
|
|
39
|
|
|
def getFormatFactory(self): |
|
40
|
|
|
import niprov.formatfactory |
|
41
|
|
|
return niprov.formatfactory.FormatFactory(dependencies=self) |
|
42
|
|
|
|
|
43
|
|
|
def getHasher(self): |
|
44
|
|
|
import niprov.hashing |
|
45
|
|
|
return niprov.hashing.Hasher() |
|
46
|
|
|
|
|
47
|
|
|
def getLibraries(self): |
|
48
|
|
|
import niprov.libraries |
|
49
|
|
|
return niprov.libraries.Libraries() |
|
50
|
|
|
|
|
51
|
|
|
def getListener(self): |
|
52
|
|
|
import niprov.commandline |
|
53
|
|
|
return niprov.commandline.Commandline(dependencies=self) |
|
54
|
|
|
|
|
55
|
|
|
def getLocationFactory(self): |
|
56
|
|
|
import niprov.locationfactory |
|
57
|
|
|
return niprov.locationfactory.LocationFactory(dependencies=self) |
|
58
|
|
|
|
|
59
|
|
|
def getMediumFactory(self): |
|
60
|
|
|
import niprov.mediumfactory |
|
61
|
|
|
return niprov.mediumfactory.MediumFactory(dependencies=self) |
|
62
|
|
|
|
|
63
|
|
|
def getRepository(self): |
|
64
|
|
|
import niprov.jsonfile |
|
65
|
|
|
import niprov.mongo |
|
66
|
|
|
if self.config.database_type == 'file': |
|
67
|
|
|
return niprov.jsonfile.JsonFile(dependencies=self) |
|
68
|
|
|
elif self.config.database_type == 'MongoDB': |
|
69
|
|
|
return niprov.mongo.MongoRepository(dependencies=self) |
|
70
|
|
|
|
|
71
|
|
|
def getSerializer(self): |
|
72
|
|
|
import niprov.formatjson |
|
73
|
|
|
return niprov.formatjson.JsonFormat(self) |
|
74
|
|
|
|
|
75
|
|
|
def getPictureCache(self): |
|
76
|
|
|
import niprov.pictures |
|
77
|
|
|
return niprov.pictures.PictureCache(dependencies=self) |
|
78
|
|
|
|
|
79
|
|
|
def getPipelineFactory(self): |
|
80
|
|
|
import niprov.pipelinefactory |
|
81
|
|
|
return niprov.pipelinefactory.PipelineFactory(dependencies=self) |
|
82
|
|
|
|
|
83
|
|
|
def getPolaroid(self): |
|
84
|
|
|
import niprov.polaroid |
|
85
|
|
|
return niprov.polaroid.Polaroid(dependencies=self) |
|
86
|
|
|
|
|
87
|
|
|
def getUsers(self): |
|
88
|
|
|
import niprov.users |
|
89
|
|
|
return niprov.users.Users(dependencies=self) |
|
90
|
|
|
|
|
91
|
|
|
|