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