1
2
3 """
4 Startup plugin for our various server components, called typically
5 by icegridnode after parsing etc/grid/templates.xml.
6
7 Plugin read by omero.cli.Cli during initialization. The method(s)
8 defined here will be added to the Cli class for later use.
9
10 Copyright 2008 Glencoe Software, Inc. All rights reserved.
11 Use is subject to license terms supplied in LICENSE.txt
12
13 """
14
15 import os
16 import sys
17 from omero.cli import BaseControl, CLI
18 import omero.java
19
20 HELP = """Start commands for server components"""
21
22
24
29
30
31
32 - def _prop(self, data, key):
34
36 try:
37 args["--Ice.Config"]
38 except KeyError:
39 self.ctx.die(201, "No --Ice.Config provided")
40 pre = []
41 post = []
42 for arg in args.args:
43 if arg.startswith("-D"):
44 pre.append(arg)
45 else:
46 post.append(arg)
47 return pre, post
48
50 component = str(component)
51 data = self.ctx.initData({})
52 xargs = self._prop(data, component+".xargs")
53 if len(xargs) == 0:
54 xargs = xargs_default
55 debug = self._prop(data, component+".debug")
56 if debug == "true":
57 debug = True
58 else:
59 debug = False
60 return xargs, debug
61
62 - def help(self, args=None):
63 self.ctx.out(
64 "Start the blitz server -- Reads properties via omero prefs")
65
72
74 pre, post = self._checkIceConfig(args)
75 xargs, debug = self._xargsAndDebug("indexer", ["-Xmx256M"])
76 blitz_jar = os.path.join("lib", "server", "blitz.jar")
77 omero.java.run(pre+["-jar", blitz_jar, "ome.fulltext"]+post,
78 debug=debug, xargs=xargs, use_exec=True)
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 try:
99 register("server", ServerControl, HELP)
100 except NameError:
101 if __name__ == "__main__":
102 cli = CLI()
103 cli.register("server", ServerControl, HELP)
104 cli.invoke(sys.argv[1:])
105