1 | importPackage(Packages.org.ten60.netkernel.xml.representation); |
---|
2 | |
---|
3 | importClass(Packages.com.ten60.netkernel.urii.IURRepresentation); |
---|
4 | importClass(Packages.org.ten60.netkernel.xml.representation.IAspectXDA); |
---|
5 | |
---|
6 | // get the current request |
---|
7 | req = context.getThisRequest(); |
---|
8 | |
---|
9 | // the operand determines the CWU for the generated DPML script |
---|
10 | //java.lang.System.err.println("DBG:sloot.accessor CWU["+context.getCWU()+"]["+req.getArgument("operand")+"]"); |
---|
11 | cwu = req.getArgument("operand"); |
---|
12 | |
---|
13 | // create the DPML script |
---|
14 | subreq = context.createSubRequest(); |
---|
15 | subreq.setURI("active:xslt2"); |
---|
16 | |
---|
17 | //subreq.addArgument("operand",(IURRepresentation)(context.source(req.getArgument("operand")))); |
---|
18 | operandURI = req.getArgument("operand"); |
---|
19 | if (operandURI != null) { |
---|
20 | operandValue = req.getArgumentValue(operandURI); |
---|
21 | if (operandValue != null) { |
---|
22 | subreq.addArgument("operand",operandValue); |
---|
23 | } else { |
---|
24 | subreq.addArgument("operand",operandURI); |
---|
25 | } |
---|
26 | } else |
---|
27 | java.lang.System.err.println("ERR:sloot.accessor call without an operand"); |
---|
28 | subreq.addArgument("operator","ffcpl:/tools/accessor.xsl"); |
---|
29 | |
---|
30 | script = context.issueSubRequest(subreq); |
---|
31 | |
---|
32 | //java.lang.System.err.println("DBG:created DPML script"); |
---|
33 | |
---|
34 | // dump the DPML script |
---|
35 | //context.sinkAspect("ffcpl:/trace/accessor.idoc",script.getAspect(IAspectXDA)); |
---|
36 | |
---|
37 | /**/ |
---|
38 | subreq = context.createSubRequest(); |
---|
39 | subreq.setURI("active:serialize"); |
---|
40 | subreq.addArgument("operand",script); |
---|
41 | //subreq.addArgument("target","ffcpl:/sloot-trace/accessor.idoc"); |
---|
42 | |
---|
43 | res = context.issueSubRequest(subreq); |
---|
44 | context.sinkAspect("ffcpl:/sloot-trace/accessor.idoc",res.getAspect(IAspectXDA)); |
---|
45 | /**/ |
---|
46 | |
---|
47 | //java.lang.System.err.println("DBG:dumped DPML script"); |
---|
48 | |
---|
49 | // run the DPML script |
---|
50 | subreq = context.createSubRequest(); |
---|
51 | subreq.setURI("active:dpml"); |
---|
52 | subreq.addArgument("operand",script); |
---|
53 | |
---|
54 | op = <dpml><inheritCWU>t</inheritCWU></dpml>; |
---|
55 | xop = new XmlObjectAspect(op.getXmlObject()); |
---|
56 | |
---|
57 | subreq.addArgument("operator",xop); |
---|
58 | |
---|
59 | subreq.setCWU(cwu); |
---|
60 | |
---|
61 | for(iter = req.getArguments(); iter.hasNext(); ) { |
---|
62 | arg = iter.next(); |
---|
63 | if (!(arg.equals("operand") || arg.equals("operator"))) { |
---|
64 | //java.lang.System.out.println("DBG:accessor.js:arg["+arg+"]"); |
---|
65 | argURI = req.getArgument(arg); |
---|
66 | if (argURI != null) { |
---|
67 | // java.lang.System.out.println("DBG:accessor.js:arg["+arg+"]["+argURI+"]"); |
---|
68 | argValue = req.getArgumentValue(argURI); |
---|
69 | // java.lang.System.out.println("DBG:accessor.js:arg["+arg+"]["+argURI+"]["+argValue+"]"); |
---|
70 | if (argValue != null) { |
---|
71 | // java.lang.System.out.println("DBG:accessor.js:arg["+arg+"]["+argValue+"] value"); |
---|
72 | subreq.addArgument(arg,argValue); |
---|
73 | } else { |
---|
74 | // java.lang.System.out.println("DBG:accessor.js:arg["+arg+"]["+argURI+"] URI"); |
---|
75 | subreq.addArgument(arg,argURI); |
---|
76 | } |
---|
77 | }// else |
---|
78 | // java.lang.System.out.println("DBG:accessor.js:arg["+arg+"] null"); |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | result = context.issueSubRequest(subreq); |
---|
83 | |
---|
84 | //java.lang.System.err.println("DBG:ran DPML script"); |
---|
85 | |
---|
86 | // create response, and exit |
---|
87 | response = context.createResponseFrom(result); |
---|
88 | response.setCacheable(); |
---|
89 | |
---|
90 | //java.lang.System.err.println("DBG:returned response"); |
---|