source: cats/shared/mod-SLOOT/trunk/tools/accessor.js @ 2687

Last change on this file since 2687 was 2687, checked in by mwindhouwer, 11 years ago

minor

File size: 3.1 KB
Line 
1importPackage(Packages.org.ten60.netkernel.xml.representation);
2
3importClass(Packages.com.ten60.netkernel.urii.IURRepresentation);
4importClass(Packages.org.ten60.netkernel.xml.representation.IAspectXDA);
5
6// get the current request
7req = 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")+"]");
11cwu = req.getArgument("operand");
12
13// create the DPML script
14subreq = context.createSubRequest();
15subreq.setURI("active:xslt2");
16
17//subreq.addArgument("operand",(IURRepresentation)(context.source(req.getArgument("operand"))));
18operandURI = req.getArgument("operand");
19if (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");
28subreq.addArgument("operator","ffcpl:/tools/accessor.xsl");
29
30script = 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/**/
38subreq = context.createSubRequest();
39subreq.setURI("active:serialize");
40subreq.addArgument("operand",script);
41//subreq.addArgument("target","ffcpl:/sloot-trace/accessor.idoc");
42
43res = context.issueSubRequest(subreq);
44context.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
50subreq = context.createSubRequest();
51subreq.setURI("active:dpml");
52subreq.addArgument("operand",script);
53
54op  = <dpml><inheritCWU>t</inheritCWU></dpml>;
55xop = new XmlObjectAspect(op.getXmlObject());
56
57subreq.addArgument("operator",xop);
58
59subreq.setCWU(cwu);
60
61for(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
82result = context.issueSubRequest(subreq);
83
84//java.lang.System.err.println("DBG:ran DPML script");
85
86// create response, and exit
87response = context.createResponseFrom(result);
88response.setCacheable();
89
90//java.lang.System.err.println("DBG:returned response");
Note: See TracBrowser for help on using the repository browser.