-- breaking out get-depth-adapter into it's own file. 'use' is pulling it into the...
[bkell-clj.git] / src / depth_adapter.clj
blobc26925656b6c664454aedc7fb06ce1f00d53b41c
2 (ns depth_adapter
3    (:import com.interrupt.bookkeeping.cc.analysis.DepthFirstAdapter) 
7 (defn get-depth-adapter [] 
8         
9       (proxy [DepthFirstAdapter] [] 
10          
11          ;; EXIT commnad 
12          (caseAExitCommand4 [node] 
13             
14             (println (str "caseAExitCommand4: " node))
15             
16             (proxy-super inAExitCommand4 node) 
17             (proxy-super outAExitCommand4 node)
19             (. System exit 0)
20          )
22          
23          ;; LOGIN command 
24          (caseALoginCommand3 [node] 
25             (println (str "caseALoginCommand3: " node))
26          )
27          
28          ;; PRINT command 
29          (caseAPrintCommand6 [node] 
30             (println (str "caseAPrintCommand6: " node)) 
31          )
32          
33          
34          ;; LOAD command 
35          (caseALoadCommand3 [node] 
36             (println (str "caseALoadCommand3: " node)) 
37             
38             (comment "replicating java calls in the 'DepthFirstAdapter'")
39             
40             
41             ;; check user login 
42             ;; ... TODO 
43             
44             
45             (proxy-super inALoadCommand3 node)   ;; inALoadCommand3(node);
46             
47             (if (not= (. node getLoad ) nil)     ;; if(node.getLoad() != null) { node.getLoad().apply(this); }
48                (.. node getLoad (apply this) ) 
49             )
50             
51             (if (not= (. node getLbracket ) nil) ;; if(node.getLbracket() != null) { node.getLbracket().apply(this); }
52                (.. node getLbracket (apply this) ) 
53             )
54              
55             (if (not= (. node getCommandInput ) nil) ;; if(node.getCommandInput() != null) { node.getCommandInput().apply(this); }
56                
57                (do ;; execute 'if' block 
58                   (.. node getCommandInput (apply this) ) 
59                   
60                   ;; TODO - AOptsCommandInput ... 
61                   (if (instance? com.interrupt.bookkeeping.cc.node.AOptsCommandInput (. node getCommandInput) ) 
62                      (do (println "OPTIONS input"))
63                   ) 
64                   
65                   ;; AXpathCommandInput ... 
66                   (if (instance? com.interrupt.bookkeeping.cc.node.AXpathCommandInput (. node getCommandInput) ) 
67                      
68                      (println "XPATH input")
69                      
70                      ;; trim xpath 
71                      ;; ... TODO 
72                      
73                      ;; get User 
74                      ;; ... TODO 
75                      
76                      ;; execute ADD for 'User' 
77                      ;; ... TODO 
78                      
79                   ) 
80                )
81             )
82             
83             (if (not= (. node getRbracket ) nil) ;; if(node.getRbracket() != null) { node.getRbracket().apply(this); }
84                (.. node getRbracket (apply this) ) 
85             )
86             
87             
88             (proxy-super outALoadCommand3 node)  ;; outALoadCommand3(node);
89             
90          )
91          
92          ;; ADD command (for registering users too) 
93                   ;; 1. check that there's not an existing user 
94                   ;; 2. add corresponding default group to the new user 
95                   ;; 3. add to aauth.groups 
96                   ;; 4. add to aauth.users 
97                   ;; 5. add Associated Bookkeeping to Group 
98          
99          
100         )