-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathenv.xml
More file actions
executable file
·481 lines (391 loc) · 16 KB
/
Copy pathenv.xml
File metadata and controls
executable file
·481 lines (391 loc) · 16 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
<?xml version="1.0"?>
<project default="FGLDEV.init" basedir=".">
<echo message="FOGDEV Environment pulling in property files" />
<property file="project.properties" />
<property file="localbuild.properties" />
<!--
######################################################
Some Path definitions useful for compiling and tooling
######################################################
-->
<path id="fgl.ant.classpath">
<fileset dir="lib/anttask">
<include name="**/*.jar" />
</fileset>
</path>
<path id="fgl.groovy.classpath">
<fileset dir="lib/groovy">
<include name="**/*.jar" />
</fileset>
</path>
<path id="fgl.cmdline.classpath">
<fileset dir="lib/client">
<include name="**/*.jar" />
</fileset>
</path>
<!--
###############################
some taskdefs
###############################
-->
<taskdef name="car" classname="com.quest.nitro.tools.ant.cartridge.Car" classpathref="fgl.ant.classpath" />
<!-- Basic Tasks -->
<target name="FGLDEV.init">
<echo message="FOGDEV Environment : Global Dev Init called" />
</target>
<target name="FGLDEV.clearLib" description="Clears the library paths from old jar files">
<delete failonerror="true">
<fileset dir="${fgldev.lib.foglight}" includes="**/*" />
<fileset dir="${fgldev.lib.spid}" includes="**/*" />
<fileset dir="${fgldev.lib.wcf}" includes="**/*" />
</delete>
</target>
<target name="FGLDEV.prepareLib" description="Use this target to initialize the lib paths (read the libs from your current installation">
<delete failonerror="false">
<fileset dir="${fgldev.lib.foglight}" includes="**/*" />
<fileset dir="${fgldev.lib.spid}" includes="**/*" />
<fileset dir="${fgldev.lib.wcf}" includes="**/*" />
</delete>
<echo message="Building WCF" />
<unzip src="${fgldev.server.dir}/${fgldev.console.deploy}" dest="${fgldev.lib.wcf}">
<patternset>
<include name="**/wcf-*.jar" />
<exclude name="**/wcf-core-ressources.jar" />
</patternset>
</unzip>
<delete failonerror="false">
<fileset dir="${fgldev.root}/tmp_war/" includes="console.war"></fileset>
</delete>
<mkdir dir="${fgldev.root}/tmp_war/console.war"/>
<unzip src="${fgldev.server.dir}/${fgldev.console.deploy}" dest="${fgldev.lib.wcf}">
<patternset>
<include name="**/wcf-*.jar" />
<exclude name="**/wcf-core-ressources.jar" />
</patternset>
</unzip>
<unzip src="${fgldev.server.dir}/${fgldev.console.deploy}" dest="${fgldev.root}/tmp_war/console.war">
<patternset>
<include name="WEB-INF/classes/**/*" />
</patternset>
</unzip>
<unzip src="${fgldev.server.dir}/server/default/deploy/foglight.sar" dest="${fgldev.lib.wcf}">
<patternset>
<include name="**/wcf-*.jar" />
</patternset>
</unzip>
<jar destfile="${fgldev.lib.foglight}/fl_console.jar" basedir="${fgldev.root}/tmp_war/console.war/WEB-INF/classes" >
<include name="com/quest/nitro/**/*"/>
</jar>
<echo message="Building WCF --fLATTEN" />
<move todir="${fgldev.lib.wcf}" overwrite="true" verbose="true">
<fileset dir="${fgldev.lib.wcf}">
<include name="**/*" />
</fileset>
</move>
<deltree dir="${fgldev.lib.wcf}/WEB-INF" />
<echo message="Building SPID" />
<copy todir="${fgldev.lib.spid}" overwrite="true" verbose="true" flatten="true">
<fileset dir="${fgldev.spid.dir}/spid/${fgldev.spid.version}/lib/">
<include name="**/*.jar" />
</fileset>
</copy>
<echo message="Building FMS" />
<copy todir="${fgldev.lib.foglight}" overwrite="true" verbose="true" flatten="true">
<fileset dir="${fgldev.server.dir}/client">
<include name="**/*.jar" />
</fileset>
</copy>
<copy tofile="${fgldev.lib.foglight}/foglight_sar.jar" overwrite="true" verbose="true" flatten="true">
<fileset dir="${fgldev.server.dir}/server/default/deploy/">
<include name="foglight.sar" />
</fileset>
</copy>
<delete dir="${fgldev.root}/tmp_war/lib" failonerror="false" />
<mkdir dir="${fgldev.root}/tmp_war/lib" />
<unjar src="${fgldev.server.dir}/server/default/deploy/foglight.sar" dest="${fgldev.root}/tmp_war/lib">
<patternset>
<include name="com/quest/nitro/service/**/*MBean.class" />
<include name="com/quest/nitro/model/**/*" />
<include name="com/quest/nitro/util/**/*" />
</patternset>
</unjar>
<jar destfile="${fgldev.lib.foglight}/fl.jar" basedir="${fgldev.root}/tmp_war/lib" includes="**/*" />
<delete dir="${fgldev.root}/tmp_war/lib" failonerror="false" />
<copy todir="${fgldev.dtd}">
<fileset dir="${fgldev.server.dir}/dtd" includes="**/*" />
</copy>
</target>
<target name="FGLDEV.showProperties" description="Show the current Properties">
<echo message="FGLDEV Properties:" />
<echo message="################################" />
<echoproperties prefix="fgldev" />
<echo message="################################" />
</target>
<!-- ##############################
Script Taskdefs and Targets
##############################
-->
<taskdef name="groovy"
classname="org.codehaus.groovy.ant.Groovy" classpathref="fgl.groovy.classpath">
</taskdef>
<macrodef name="exportUI">
<attribute name="filename" />
<attribute name="module" />
<attribute name="server" />
<sequential>
<echo message="Exporting Mod @{module} for server @{server}" />
<java jar="${fgldev.server.dir}/client/foglight-cmdline-client.jar" fork="true" failonerror="true">
<arg line='-usr ${fgldev.usr} -pwd ${fgldev.pwd} -srv @{server} -cmd util:uiexport -f @{filename} -m @{module} ' />
<classpath path="${fgldev.server.dir}/client">
</classpath>
</java>
</sequential>
</macrodef>
<macrodef name="exportRules">
<attribute name="filename" />
<attribute name="tmpFile" />
<attribute name="scopingQuery" />
<sequential>
<delete file="@{tmpFile}" failonerror="false"></delete>
<java jar="${fgldev.server.dir}/client/foglight-cmdline-client.jar" fork="true" failonerror="true">
<arg line='-usr ${fgldev.usr} -pwd ${fgldev.pwd} -cmd util:configexport -f @{tmpFile}' />
<classpath path="${fgldev.server.dir}/client">
</classpath>
</java>
<property name="local.tmpFile" value = "@{tmpFile}"/>
<property name="local.file" value = "@{filename}"/>
<property name="scopingQuery" value ="@{scopingQuery}"/>
<groovy><![CDATA[
import org.dom4j.io.*
import org.dom4j.*;
class PruningHandler implements ElementHandler {
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
car.detach() // prune the tree
}
}
class RuleHandler implements ElementHandler {
String _name
public RuleHandler( String name) {
_name = name
println "Setup:"+_name
}
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
if (car.element("scoping-query") != null && !(car.element("scoping-query").attribute("text") =~ _name)) {
car.detach() // prune the tree
} else if (car.element("scoping-query") == null ){
car.detach() // prune the tree
}
}
}
class DerivationHandler implements ElementHandler {
String _name
public DerivationHandler( String name) {
_name = name
println "Setup:"+_name
}
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
if (!(car.attribute("domain-query") =~ _name)) {
car.detach() // prune the tree
}
}
}
File f = new File(properties["local.tmpFile"])
String content = "";
f.withInputStream{ is->
content = is.getText()
}
def reader = new StringReader(content)
def reader2 = new SAXReader()
def handler = new PruningHandler()
def ruleHandler = new RuleHandler(properties["scopingQuery"])
def derivationHandler = new DerivationHandler(properties["scopingQuery"])
reader2.addHandler('/foglight-config/persistable-script', handler)
reader2.addHandler('/foglight-config/persistable-config-model', handler)
reader2.addHandler('/foglight-config/life-cycle-impl', handler)
reader2.addHandler('/foglight-config/registry-variable', handler)
reader2.addHandler('/foglight-config/simple-threshold', handler)
reader2.addHandler('/foglight-config/retention-policy-impl', handler)
reader2.addHandler('/foglight-config/named-schedule', handler)
reader2.addHandler('/foglight-config/scheduled-report', handler)
reader2.addHandler('/foglight-config/severity-family', ruleHandler)
reader2.addHandler('/foglight-config/simple-rule', ruleHandler)
reader2.addHandler('/foglight-config/derivation-definition', derivationHandler)
def records = reader2.read(reader).rootElement
def messages = []
OutputFormat f2 = new OutputFormat()
f2.setNewLineAfterDeclaration(true)
def writer = new StringWriter()
def w = new XMLWriter(writer,f2).writeNode(records)
org.jdom.Document doc = new org.jdom.input.SAXBuilder(false).build(new StringReader(writer.toString()));
FileOutputStream out = new FileOutputStream(properties["local.file"]);
new org.jdom.output.XMLOutputter(org.jdom.output.Format.getPrettyFormat()).output(doc,out);
]]>
</groovy>
</sequential>
</macrodef>
<macrodef name="exportRegistry">
<attribute name="filenameReg" />
<attribute name="tmpFile" />
<attribute name="scopingQuery" />
<sequential>
<delete file="@{tmpFile}" failonerror="false"></delete>
<java jar="${fgldev.server.dir}/client/foglight-cmdline-client.jar" fork="true" failonerror="true">
<arg line='-usr ${fgldev.usr} -pwd ${fgldev.pwd} -cmd util:configexport -f @{tmpFile}' />
<classpath path="${fgldev.server.dir}/client">
</classpath>
</java>
<property name="local.tmpFile" value = "@{tmpFile}"/>
<property name="local.file.reg" value = "@{filenameReg}"/>
<property name="scopingQueryReg" value ="@{scopingQuery}"/>
<groovy><![CDATA[
import org.dom4j.io.*
import org.dom4j.*;
class PruningHandler implements ElementHandler {
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
car.detach() // prune the tree
}
}
class RegHandler implements ElementHandler {
String _name
public RegHandler( String name) {
_name = name
println "Setup:" + _name
}
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
if (!(car.attribute("name") =~ _name)) {
car.detach() // prune the tree
}
}
}
File f = new File(properties["local.tmpFile"])
String content = "";
f.withInputStream{ is->
content = is.getText()
}
def reader = new StringReader(content)
def reader2 = new SAXReader()
def handler = new PruningHandler()
def regHandler = new RegHandler(properties["scopingQueryReg"])
reader2.addHandler('/foglight-config/persistable-script', handler)
reader2.addHandler('/foglight-config/persistable-config-model', handler)
reader2.addHandler('/foglight-config/life-cycle-impl', handler)
reader2.addHandler('/foglight-config/registry-variable', regHandler)
reader2.addHandler('/foglight-config/simple-threshold', handler)
reader2.addHandler('/foglight-config/retention-policy-impl', handler)
reader2.addHandler('/foglight-config/named-schedule', handler)
reader2.addHandler('/foglight-config/scheduled-report', handler)
reader2.addHandler('/foglight-config/severity-family', handler)
reader2.addHandler('/foglight-config/simple-rule', handler)
reader2.addHandler('/foglight-config/derivation-definition', handler)
def records = reader2.read(reader).rootElement
def messages = []
OutputFormat f2 = new OutputFormat()
f2.setNewLineAfterDeclaration(true)
def writer = new StringWriter()
def w = new XMLWriter(writer,f2).writeNode(records)
println "Write to:"+properties["local.file.reg"]
org.jdom.Document doc = new org.jdom.input.SAXBuilder(false).build(new StringReader(writer.toString()));
FileOutputStream out = new FileOutputStream(properties["local.file.reg"]);
new org.jdom.output.XMLOutputter(org.jdom.output.Format.getPrettyFormat()).output(doc,out);
]]>
</groovy>
</sequential>
</macrodef>
<macrodef name="exportASP">
<attribute name="filenameASP" />
<attribute name="tmpFile" />
<attribute name="agentName" />
<attribute name="aspName" />
<sequential>
<delete file="@{tmpFile}" failonerror="false"></delete>
<java jar="${fgldev.server.dir}/client/foglight-cmdline-client.jar" fork="true" failonerror="true">
<arg line='-usr ${fgldev.usr} -pwd ${fgldev.pwd} -cmd util:configexport -f @{tmpFile}' />
<classpath path="${fgldev.server.dir}/client">
</classpath>
</java>
<property name="local.tmpFile" value = "@{tmpFile}"/>
<property name="local.file.ASP" value = "@{filenameASP}"/>
<property name="agentName" value ="@{agentName}"/>
<property name="aspName" value ="@{aspName}"/>
<groovy><![CDATA[
import org.dom4j.io.*
import org.dom4j.*;
class PruningHandler implements ElementHandler {
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
car.detach() // prune the tree
}
}
class ASPHandler implements ElementHandler {
String _name
String _knownName
public ASPHandler( String agentName, String knownName) {
_name = agentName
_knownName = knownName
println _name +":"+_knownName
}
def messages = []
public void onStart(ElementPath path) { }
public void onEnd(ElementPath path) {
def car = path.current
boolean found = false;
if (car.element("agent_type") != null && (car.element("agent_type").getText() =~ _name)) {
if (car.element("known_name") != null && !(car.element("known_name").getText() =~ _knownName)) {
found = true
}
}
if (!found) car.detach() // prune the tree
}
}
File f = new File(properties["local.tmpFile"])
String content = "";
f.withInputStream{ is->
content = is.getText()
}
def reader = new StringReader(content)
def reader2 = new SAXReader()
def handler = new PruningHandler()
def configHandler = new ASPHandler(properties["agentName"],properties["aspName"])
reader2.addHandler('/foglight-config/persistable-script', handler)
reader2.addHandler('/foglight-config/life-cycle-impl', handler)
reader2.addHandler('/foglight-config/registry-variable', handler)
reader2.addHandler('/foglight-config/simple-threshold', handler)
reader2.addHandler('/foglight-config/retention-policy-impl', handler)
reader2.addHandler('/foglight-config/named-schedule', handler)
reader2.addHandler('/foglight-config/scheduled-report', handler)
reader2.addHandler('/foglight-config/severity-family', handler)
reader2.addHandler('/foglight-config/simple-rule', handler)
reader2.addHandler('/foglight-config/derivation-definition', handler)
reader2.addHandler('/foglight-config/persistable-config-model', configHandler)
def records = reader2.read(reader).rootElement
def messages = []
OutputFormat f2 = new OutputFormat()
f2.setNewLineAfterDeclaration(true)
def writer = new StringWriter()
def w = new XMLWriter(writer,f2).writeNode(records)
println "Write to:"+properties["local.file.ASP"]
org.jdom.Document doc = new org.jdom.input.SAXBuilder(false).build(new StringReader(writer.toString()));
FileOutputStream out = new FileOutputStream(properties["local.file.ASP"]);
new org.jdom.output.XMLOutputter(org.jdom.output.Format.getPrettyFormat()).output(doc,out);
]]>
</groovy>
</sequential>
</macrodef>
</project>