1 package com
.interrupt
.bookkeeping
.cc
;
3 import java
.io
.Serializable
;
4 import java
.util
.ArrayList
;
5 import java
.util
.HashMap
;
7 import org
.apache
.log4j
.Logger
;
9 import com
.interrupt
.bob
.base
.Bob
;
10 import com
.interrupt
.bob
.base
.IBob
;
11 import com
.interrupt
.bob
.base
.IVisitor
;
12 import com
.interrupt
.bookkeeping
.cc
.bkell
.aauth
.Aauthentication
;
13 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.IMemory
;
14 import com
.interrupt
.bookkeeping
.ISystem
;
15 import com
.interrupt
.bookkeeping
.cc
.analysis
.DepthFirstAdapter
;
16 import com
.interrupt
.bookkeeping
.cc
.bkell
.Bkell
;
17 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.AddCommand
;
18 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CommitCommand
;
19 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CreateCommand
;
20 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.FindCommand
;
21 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.FindVisitor
;
22 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.GResult
;
23 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.GTokenLiterals
;
24 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.IResult
;
25 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.ITokenLiterals
;
26 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.IVariable
;
27 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LoadCommand
;
28 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LoginCommand
;
29 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LogoutCommand
;
30 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.ReverseCommand
;
31 import com
.interrupt
.bookkeeping
.cc
.bkell
.command
.Variable
;
32 import com
.interrupt
.bookkeeping
.cc
.executor
.CreateExecutor
;
33 import com
.interrupt
.bookkeeping
.cc
.executor
.CreateHelper
;
34 import com
.interrupt
.bookkeeping
.cc
.executor
.LoadExecutor
;
35 import com
.interrupt
.bookkeeping
.cc
.executor
.LoadHelper
;
36 import com
.interrupt
.bookkeeping
.cc
.executor
.VisitorApplyAdd
;
37 import com
.interrupt
.bookkeeping
.cc
.executor
.VisitorApplyRemove
;
38 import com
.interrupt
.bookkeeping
.cc
.node
.AAddCommand1
;
39 import com
.interrupt
.bookkeeping
.cc
.node
.AC1Command
;
40 import com
.interrupt
.bookkeeping
.cc
.node
.AC2Command
;
41 import com
.interrupt
.bookkeeping
.cc
.node
.AC3Command
;
42 import com
.interrupt
.bookkeeping
.cc
.node
.AC4Command
;
43 import com
.interrupt
.bookkeeping
.cc
.node
.AC5Command
;
44 import com
.interrupt
.bookkeeping
.cc
.node
.ACmdCommandInput
;
45 import com
.interrupt
.bookkeeping
.cc
.node
.ACmdExpr
;
46 import com
.interrupt
.bookkeeping
.cc
.node
.ACommitCommand7
;
47 import com
.interrupt
.bookkeeping
.cc
.node
.ACreateCommand3
;
48 import com
.interrupt
.bookkeeping
.cc
.node
.AExitCommand4
;
49 import com
.interrupt
.bookkeeping
.cc
.node
.AFindCommand2
;
50 import com
.interrupt
.bookkeeping
.cc
.node
.AIlist
;
51 import com
.interrupt
.bookkeeping
.cc
.node
.AListCommand2
;
52 import com
.interrupt
.bookkeeping
.cc
.node
.ALoadCommand3
;
53 import com
.interrupt
.bookkeeping
.cc
.node
.ALoginCommand3
;
54 import com
.interrupt
.bookkeeping
.cc
.node
.ALogoutCommand4
;
55 import com
.interrupt
.bookkeeping
.cc
.node
.AOptsCommandInput
;
56 import com
.interrupt
.bookkeeping
.cc
.node
.APrintCommand6
;
57 import com
.interrupt
.bookkeeping
.cc
.node
.ARemoveCommand1
;
58 import com
.interrupt
.bookkeeping
.cc
.node
.AReverseCommand5
;
59 import com
.interrupt
.bookkeeping
.cc
.node
.ATwohandexpr
;
60 import com
.interrupt
.bookkeeping
.cc
.node
.AUpdateCommand1
;
61 import com
.interrupt
.bookkeeping
.cc
.node
.AVarCommandInput
;
62 import com
.interrupt
.bookkeeping
.cc
.node
.AXmlCommandInput
;
63 import com
.interrupt
.bookkeeping
.cc
.node
.AXmlCommandInputRef
;
64 import com
.interrupt
.bookkeeping
.cc
.node
.Node
;
65 import com
.interrupt
.bookkeeping
.cc
.node
.PCommandInput
;
66 import com
.interrupt
.bookkeeping
.cc
.node
.PIlist
;
67 import com
.interrupt
.bookkeeping
.exception
.AuthorisationException
;
68 import com
.interrupt
.bookkeeping
.journal
.IEntries
;
69 import com
.interrupt
.bookkeeping
.system
.BookkeepingSystem
;
70 import com
.interrupt
.bookkeeping
.users
.IUser
;
71 import com
.interrupt
.bookkeeping
.users
.IUserSession
;
72 import com
.interrupt
.bookkeeping
.users
.User
;
73 import com
.interrupt
.bookkeeping
.util
.Util
;
74 import com
.interrupt
.spittoon
.Spittoon
;
76 public class ExpressionVisitor
extends DepthFirstAdapter
implements Serializable
{
79 private Logger logger
= Logger
.getLogger(ExpressionVisitor
.class);
81 private IUserSession userSession
= null;
82 private Aauthentication aauthentication
= null;
83 private AXmlCommandInputRef previousCommandResult
= null;
84 private Bkell _bkellEnv
= null;
85 private boolean active
= true;
86 private Spittoon spittoon
= null;
88 public ExpressionVisitor() {
90 public ExpressionVisitor(Spittoon spitt
) {
95 public boolean isActive() {
98 public void setActive(boolean active
) {
103 public Bkell
getBkellEnv() {
106 public void setBkellEnv(Bkell env
) {
111 public AXmlCommandInputRef
getPreviousCommandResult() {
112 return previousCommandResult
;
114 public void setPreviousCommandResult(AXmlCommandInputRef previousCommandResult
) {
115 this.previousCommandResult
= previousCommandResult
;
118 public Aauthentication
getAauthentication() {
119 return aauthentication
;
121 public void setAauthentication(Aauthentication aauthentication
) {
122 this.aauthentication
= aauthentication
;
126 public IUserSession
getUserSession() {
129 public void setUserSession(IUserSession userSession
) {
130 this.userSession
= userSession
;
134 /*********************
139 * writing out a variable to memory
141 public void caseACmdExpr(ACmdExpr node
) {
147 String variableName
= "previous";
148 IBob commandResult
= null;
149 if(node
.getCommand() != null) {
151 //** the 'node' should now be an 'AXmlCommandInput'
152 node
.getCommand().apply(this);
154 // get result of command
155 if(this.getPreviousCommandResult() != null) {
157 //logger.debug("caseCmdExpr / Previous Command ["+this.getPreviousCommandResult()+"] / Previous XML ["+this.getPreviousCommandResult().getXmlCommandInput()+"] / Reference ["+this.getPreviousCommandResult().getReference()+"]");
158 //logger.debug("caseCmdExpr / Previous Command ["+this.getPreviousCommandResult()+"] / Previous XML ["+this.getPreviousCommandResult().getXmlCommandInput()+"] / Reference ["+this.getPreviousCommandResult().getReference()+"]");
160 //commandResult = this._createBlock(this.getPreviousCommandResult().getXmlCommandInput());
161 commandResult
= this.getPreviousCommandResult().getReference();
165 if(node
.getSemicolon() != null) {
167 node
.getSemicolon().apply(this);
171 // the 'previousCommandResult' has already been evaluated
174 // store in the bkell environments
175 IVariable variable
= new Variable();
176 variable
.setName(variableName
);
177 variable
.addChild(commandResult
);
178 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).removeVariableByName(variableName
);
179 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).addVariable(variable
);
185 public void caseATwohandexpr(ATwohandexpr node
) {
188 inATwohandexpr(node
);
190 String variableName
= null;
191 IBob commandResult
= null;
193 if(node
.getVar() != null) {
195 node
.getVar().apply(this);
197 if(node
.getWord() != null) {
199 node
.getWord().apply(this);
202 variableName
= node
.getWord().getText();
204 //logger.debug("putting variableName into memory["+variableName+"]");
207 if(node
.getEquals() != null) {
209 node
.getEquals().apply(this);
211 if(node
.getCommand() != null) {
213 node
.getCommand().apply(this);
215 // get result of command
216 commandResult
= this._createBlock(this.getPreviousCommandResult().getXmlCommandInput());
220 // the 'previousCommandResult' has already been set
223 // store in the bkell environments
224 String previousVarName
= "previous";
225 IVariable variablePrev
= new Variable();
226 variablePrev
.setName(previousVarName
);
227 variablePrev
.addChild(commandResult
);
228 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).removeVariableByName(previousVarName
);
229 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).addVariable(variablePrev
);
231 IVariable variable
= new Variable();
232 variable
.setName(variableName
);
233 variable
.addChild(commandResult
);
234 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).removeVariableByName(variableName
);
235 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).addVariable(variable
);
237 outATwohandexpr(node
);
242 /* reading a variable as input
244 public void caseAVarCommandInput(AVarCommandInput node
) {
246 inAVarCommandInput(node
);
248 String variableName
= null;
249 if(node
.getVarname() != null) {
251 node
.getVarname().apply(this);
252 variableName
= node
.getVarname().toString();
254 // remove all spaces that sablecc inserts - very annoying
255 //variableName = variableName.replaceAll(' ');
257 // remove the '@' sign
258 variableName
= variableName
.substring(1); //** if this fails, then the user only put in the '@'
259 variableName
= variableName
.trim();
264 // retrieve from the bkell environments
266 //logger.debug("Printing out the systems memory / Seeking variable name["+variableName+"]");
267 IBob commandResult
= null;
268 IMemory memory
= (IMemory
)this.getBkellEnv().findMemoryById("main.memory");
269 if(variableName
.equals("memory")) {
271 HashMap allPrefixes
= new HashMap();
274 ISystem system
= BookkeepingSystem
.instance().getMODEL();
275 while(system
.canPull()) {
277 eachbob
= system
.pullNext();
278 allPrefixes
.putAll(eachbob
.getPrefixMappings());
280 memory
.setPrefixMappings(allPrefixes
);
281 commandResult
= memory
;
285 IVariable variable
= memory
.findVariableByName(variableName
);
286 commandResult
= (IBob
)variable
.getChildren().get(0);
290 // setting the 'previousCommandResult'
291 AXmlCommandInput replacor
= LoadHelper
.reparse(commandResult
.toXML(false));
292 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
293 replacorReference
.setXmlCommandInput(replacor
);
294 replacorReference
.setReference(commandResult
);
295 this.setPreviousCommandResult(replacorReference
);
298 node
.replaceBy(replacor
);
300 outAVarCommandInput(node
);
308 public void caseACommitCommand7(ACommitCommand7 node
) {
310 inACommitCommand7(node
);
312 String cxpath
= null;
313 String inputXML
= null;
315 if(this.userSession
== null) {
316 throw new AuthorisationException("You are not logged in");
318 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
321 inACommitCommand7(node
);
322 if(node
.getCommit() != null)
324 node
.getCommit().apply(this);
326 if(node
.getLbdepth1() != null)
328 node
.getLbdepth1().apply(this);
330 if(node
.getLbdepth2() != null)
332 node
.getLbdepth2().apply(this);
334 if(node
.getInput1() != null) {
336 node
.getInput1().apply(this);
337 cxpath
= node
.getInput1().toString();
338 cxpath
= cxpath
.replaceAll("`", "");
339 cxpath
= cxpath
.trim();
341 if(node
.getRbdepth2() != null)
343 node
.getRbdepth2().apply(this);
345 if(node
.getInput2() != null) {
347 node
.getInput2().apply(this);
349 logger
.debug("caseACommitCommand7::getInput2 > class["+node
.getInput2().getClass()+"] > data["+node
.getInput2().toString()+"]");
351 if( node
.getInput2().getClass() == AXmlCommandInput
.class ) { // raw XML input
353 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
354 replacorReference
.setXmlCommandInput((AXmlCommandInput
)node
.getInput2());
355 this.setPreviousCommandResult(replacorReference
);
358 else if( node
.getInput2().getClass() == AVarCommandInput
.class ) { // VARIABLE input
360 inputXML
= node
.getInput2().toString();
362 else { // result from PREVIOUS command
364 AXmlCommandInputRef cinput
= this.getPreviousCommandResult();
365 String cinput_s
= cinput
.getXmlCommandInput().toString();
366 String input_3
= Util
.filterSpacesFromXML(cinput_s
);
368 IBob created
= new Bob().load( input_3
, "xml/bookkeeping.system.xml" );
369 inputXML
= created
.toXML();
372 CommitCommand commitc
= new CommitCommand(spittoon
);
373 commitc
.setAauthentication(this.getAauthentication());
374 commitc
.setContextXPath(cxpath
);
375 commitc
.setInputXML(inputXML
);
377 commitc
.execute(user
);
380 if(node
.getRbdepth1() != null)
382 node
.getRbdepth1().apply(this);
384 outACommitCommand7(node
);
391 public void caseAPrintCommand6(APrintCommand6 node
) {
393 inAPrintCommand6(node
);
394 if(node
.getPrint() != null) {
396 node
.getPrint().apply(this);
398 if(node
.getLbracket() != null) {
400 node
.getLbracket().apply(this);
402 if(node
.getCommandInput() != null) {
405 node
.getCommandInput().apply(this);
407 if(this.userSession
== null) {
408 throw new AuthorisationException("You are not logged in");
410 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
412 CreateCommand ccmd
= new CreateCommand();
413 ccmd
.setAauthentication(this.aauthentication
);
415 IResult result
= CreateHelper
.execute(user
, ccmd
, this.getPreviousCommandResult().getXmlCommandInput());
416 if(result
.allChildren().get(0) != null) {
418 IBob bobResult
= (IBob
)result
.allChildren().get(0);
420 bobResult
.toXML(System
.out
);
426 if(node
.getRbracket() != null) {
428 node
.getRbracket().apply(this);
430 outAPrintCommand6(node
);
435 /* bookkeeping structure manipulations - create, load, add, remove, reverse, find, list
437 public void caseACreateCommand3(ACreateCommand3 node
) {
440 IResult result
= null;
441 IBob bobReplacor
= null;
443 inACreateCommand3(node
);
445 //logger.debug("caseACreateCommand3["+node+"] CALLED");
446 if(node
.getCreate() != null) {
448 node
.getCreate().apply(this);
450 if(node
.getLbracket() != null) {
452 node
.getLbracket().apply(this);
454 if(node
.getCommandInput() != null) {
456 node
.getCommandInput().apply(this);
459 CreateExecutor cexecutor
= new CreateExecutor();
460 cexecutor
.setAauthenticationToInject(this.aauthentication
);
462 if(this.userSession
== null) {
463 throw new AuthorisationException("You are not logged in");
465 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
466 result
= cexecutor
.execute(user
, node
);
468 // replaceby XMLCommandInput
469 //logger.debug("1. "+ node.getClass());
470 //logger.debug("2. "+ node.parent().getClass());
471 //logger.debug("3. "+ node.parent().parent().getClass());
472 //logger.debug("4. "+ node.parent().parent().parent().getClass());
475 List children
= result
.getChildren();
476 bobReplacor
= (IBob
)children
.get(0);
479 //if(node.parent().parent() instanceof ACmdCommandInput) {
481 // setting the 'previousCommandResult'
482 AXmlCommandInput replacor
= LoadHelper
.reparse(bobReplacor
.toXML(false));
483 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
484 replacorReference
.setXmlCommandInput(replacor
);
485 replacorReference
.setReference(bobReplacor
);
486 this.setPreviousCommandResult(replacorReference
);
488 System
.out
.println("1. caseACreateCommand3: setting the previous command result - : "+ result
.toXML(false));
490 // for commands that use the result of create, we are replacing this node with the XML result
491 // - replaceby XMLCommandInput
492 //node.parent().parent().replaceBy(replacor);
497 if(node
.getRbracket() != null) {
499 node
.getRbracket().apply(this);
502 System
.out
.println("2. caseACreateCommand3: setting the previous command result: "+ result
.toXML(false));
504 outACreateCommand3(node
);
506 //logger.debug("Create THE END: ["+bobReplacor+"] CALLED");
510 public void caseALoadCommand3(ALoadCommand3 node
) {
513 inALoadCommand3(node
);
515 //logger.debug("caseALoadCommand3["+node+"] CALLED");
516 //BookkeepingSystem bsystem = BookkeepingSystem.instance();
517 //ISystem model = bsystem.getMODEL();
520 if(node
.getLoad() != null) {
521 node
.getLoad().apply(this);
523 if(node
.getLbracket() != null) {
524 node
.getLbracket().apply(this);
526 if(node
.getCommandInput() != null) {
528 // collect tag & all attributes
529 // list all possible closest results
530 // return first one; warn user that there were other possibilities, and to isolate search
532 String cxpath
= node
.getCommandInput().toString();
533 cxpath
= cxpath
.replaceAll("`", "");
534 cxpath
= cxpath
.trim();
535 logger
.debug("caseALoadCommand3 > class["+node
.getCommandInput().getClass()+"] > data["+ cxpath
+"]");
538 node
.getCommandInput().apply(this);
539 LoadExecutor lexecutor
= new LoadExecutor();
540 if(this.userSession
== null) {
541 throw new AuthorisationException("You are not logged in");
543 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
545 lexecutor
.setAauthenticationToInject( this.getAauthentication() );
546 lexecutor
.setSpittoon(spittoon
);
547 lexecutor
.setContextXPath( cxpath
);
548 IResult result
= lexecutor
.execute(user
, node
);
550 //logger.debug("1. "+ node.getClass());
551 //logger.debug("2. "+ node.parent().getClass());
552 //logger.debug("3. "+ node.parent().parent().getClass());
553 //logger.debug("4. "+ node.parent().parent().parent().getClass());
555 List children
= result
.getChildren();
556 IBob bobReplacor
= (IBob
)children
.get(0);
558 // set nsprefixes to null
559 /*class NSPrefixVisitor extends com.interrupt.bob.base.Visitor {
560 public void visit(IBob bob) {
561 //logger.debug("NSPrefixVisitor / tag["+bob.getTagName()+"] / ns["+bob.getNamespace()+"] / ns visible["+bob.isNSVisible()+"]");
562 bob.setNSPrefix(null);
565 bobReplacor.accept(new NSPrefixVisitor());
568 // replace by XMLCommandInput
569 Logger
.getLogger("bobstate").debug(bobReplacor
.toXML(false));
571 AXmlCommandInput replacor
= LoadHelper
.reparse(bobReplacor
.toXML(false));
572 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
573 replacorReference
.setXmlCommandInput(replacor
);
574 replacorReference
.setReference(bobReplacor
);
576 // setting the 'previousCommandResult'
577 this.setPreviousCommandResult(replacorReference
);
578 if(node
.parent().parent() instanceof ACmdCommandInput
) {
579 node
.parent().parent().replaceBy(replacor
);
583 if(node
.getRbracket() != null) {
584 node
.getRbracket().apply(this);
586 outALoadCommand3(node
);
590 public void caseALoginCommand3(ALoginCommand3 node
) {
593 inALoginCommand3(node
);
594 if(node
.getLogin() != null) {
595 node
.getLogin().apply(this);
597 if(node
.getLbracket() != null) {
598 node
.getLbracket().apply(this);
600 if(node
.getCommandInput() != null) {
602 node
.getCommandInput().apply(this);
604 PCommandInput cinput
= node
.getCommandInput();
605 LoginCommand lcommand
= new LoginCommand(spittoon
);
606 lcommand
.setParent(this.getBkellEnv()); // ** TODO - a kludge to make searchTree work
609 CommandOptionVisitor covisitor
= new CommandOptionVisitor();
610 covisitor
.setCommand(lcommand
);
611 cinput
.apply(covisitor
);
613 IResult userResult
= lcommand
.execute(null); // null user entry b/c this is the command that will log the user in
614 if(userResult
== null) {
615 throw new AuthorisationException("Incorrect username / password combination");
618 this.aauthentication
= (Aauthentication
)userResult
.getChildren().get(0);
619 this.userSession
= this.aauthentication
.getUserSession();
621 logger
.debug("caseALoginCommand3::userSession: "+ this.userSession
.toXML(false));
623 AXmlCommandInput replacor
= LoadHelper
.reparse(this.userSession
.toXML(false));
624 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
625 replacorReference
.setXmlCommandInput(replacor
);
626 replacorReference
.setReference(this.userSession
);
628 // setting the 'previousCommandResult'
629 this.setPreviousCommandResult(replacorReference
);
632 if(node
.getRbracket() != null) {
633 node
.getRbracket().apply(this);
635 outALoginCommand3(node
);
637 logger
.debug("Login: userSession: " + this.userSession
);
641 public void caseALogoutCommand4(ALogoutCommand4 node
) {
643 inALogoutCommand4(node
);
644 if(node
.getLogout() != null) {
646 node
.getLogout().apply(this);
648 if(this.userSession
== null) {
649 throw new AuthorisationException("You are not logged in");
651 //IUser user = this.aauthentication.findUser(this.userSession.getUserid());
652 LogoutCommand lcommand
= new LogoutCommand(this.aauthentication
);
653 lcommand
.execute(this.aauthentication
.findUser("root")); // null user entry b/c this is the command that will log te user in
656 outALogoutCommand4(node
);
660 public void caseAAddCommand1(AAddCommand1 node
) {
664 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
665 String variableName
= null;
666 String originalTagId
= null;
667 boolean varInput
= false;
668 AVarCommandInput ceeOne
= null;
671 inAAddCommand1(node
);
672 if(node
.getAdd() != null) {
673 node
.getAdd().apply(this);
675 if(node
.getLbdepth1() != null) {
676 node
.getLbdepth1().apply(this);
678 if(node
.getLbdepth2() != null) {
679 node
.getLbdepth2().apply(this);
681 if(node
.getCommandInput() != null) {
684 if(node
.getCommandInput() instanceof AVarCommandInput
) {
686 ceeOne
= (AVarCommandInput
)node
.getCommandInput();
688 //ceeOne.getVarname().apply(this);
689 variableName
= ceeOne
.getVarname().toString();
691 // remove the '@' sign
692 variableName
= variableName
.substring(1); //** if this fails, then the user only put in the '@'
693 variableName
= variableName
.trim();
700 * IMPORTANT. XML, Options, or Command will be the input option
701 * [X] i. The Command will be processed in the visitor.
702 * [OK] ii. and the XML should be processed (not loaded)
703 * [OK] iii. We do want to process the Options though
705 node
.getCommandInput().apply(this);
706 if(node
.getCommandInput() instanceof AXmlCommandInput
) {
708 // if the input was raw XML, reparse into Bob object
709 IResult result
= CreateHelper
.execute(user
, new CreateCommand(), (AXmlCommandInput
)node
.getCommandInput());
710 addee
= (IBob
)result
.getChild(0);
713 addee
= this.getPreviousCommandResult().getReference();
715 if(addee
instanceof IResult
) {
716 addee
= (IBob
)addee
.allChildren().get(0);
718 logger
.debug("caseAAddCommand1 addee: "+ addee
.toXML(false));
720 originalTagId
= addee
.getAttributeValue("id");
723 if(node
.getRbdepth2() != null) {
724 node
.getRbdepth2().apply(this);
728 //logger.debug( "caseAAddCommand1 addee: "+ ((ISystem)addee).findAauthenticationById("main.authentication") );
729 //** process list of inputs...
731 AddCommand addCommand
= new AddCommand();
732 addCommand
.setTokenReciever(addee
);
734 List
<PIlist
> copy
= new ArrayList
<PIlist
>(node
.getIlist());
735 for(PIlist e
: copy
) {
738 logger
.debug("caseAAddCommand1 each input["+e
+"] / input class["+e
.getClass()+"] / previous["+this.getPreviousCommandResult()+"]");
741 //** now add the gear
742 if( ((AIlist
)e
).getCommandInput() instanceof AXmlCommandInput
) {
744 IResult result
= CreateHelper
.execute(user
, new CreateCommand(), (AXmlCommandInput
)((AIlist
)e
).getCommandInput());
745 addCommand
.getTokenLiterals().addChild((IBob
)result
.allChildren().get(0));
746 logger
.debug("caseAAddCommand1 <AXmlCommandInput>: " + (IBob
)result
.allChildren().get(0));
749 else if(this.getPreviousCommandResult() != null) {
751 logger
.debug("caseAAddCommand1 <previous command result>: "+ this.getPreviousCommandResult().getReference());
752 addCommand
.getTokenLiterals().addChild(this.getPreviousCommandResult().getReference());
759 //logger.debug( "caseAAddCommand2 addee USERS: "+ ((Aauthentication)((ISystem)addee).findAauthenticationById("main.authentication")).getUsers() );
760 addCommand
.execute(user
); //**
764 if(node
.getRbdepth1() != null) {
765 node
.getRbdepth1().apply(this);
767 outAAddCommand1(node
);
769 //logger.debug("Add: THE END ["+addee+"]");
772 logger
.debug(">> main memory: "+ ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")) );
773 logger
.debug(">> variable name ["+ variableName
+"] / variable ["+ ((IMemory
)this.getBkellEnv().findMemoryById("main.memory"))
774 .findVariableByName(variableName
) +"]");
776 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory"))
777 .findVariableByName(variableName
).replace(addee
.getTagName(), originalTagId
, addee
);
780 // setting the 'previousCommandResult'
781 AXmlCommandInput replacor
= LoadHelper
.reparse(addee
.toXML(false));
782 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
783 replacorReference
.setXmlCommandInput(replacor
);
784 replacorReference
.setReference(addee
);
785 this.setPreviousCommandResult(replacorReference
);
786 //logger.debug("Add / Previous Command "+ addee.toXML());
790 public void caseAUpdateCommand1(AUpdateCommand1 node
) {
793 String originalTagId
= null;
794 String variableName
= null;
795 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
797 logger
.debug("c1 class["+node
.getC1().getClass()+"]");
798 logger
.debug(node
.getC1() instanceof AXmlCommandInput
);
799 logger
.debug(node
.getC1() instanceof com
.interrupt
.bookkeeping
.cc
.node
.AVarCommandInput
);
802 * KLUDGE since 'node.getC1()' gets converted to an 'AXmlCommandInput' on first apply
804 boolean xmlInput
= false;
805 boolean varInput
= false;
806 AVarCommandInput ceeOne
= null;
807 if(node
.getC1() instanceof AXmlCommandInput
) {
810 else if(node
.getC1() instanceof com
.interrupt
.bookkeeping
.cc
.node
.AVarCommandInput
) {
812 ceeOne
= (AVarCommandInput
)node
.getC1();
816 inAUpdateCommand1(node
);
817 if(node
.getUpdate() != null)
819 node
.getUpdate().apply(this);
821 if(node
.getLbdepth1() != null)
823 node
.getLbdepth1().apply(this);
825 if(node
.getLbdepth2() != null)
827 node
.getLbdepth2().apply(this);
829 if(node
.getC1() != null)
832 logger
.debug("Grrr 1");
835 node
.getC1().apply(this);
838 logger
.debug("Grrr 2");
841 IResult result
= CreateHelper
.execute(user
, new CreateCommand(), (AXmlCommandInput
)node
.getC1());
842 updatee
= (IBob
)result
.getChild(0);
846 logger
.debug("Grrr 3");
848 // 2. for variable name
849 if( ceeOne
!= null) {
851 ceeOne
.getVarname().apply(this);
852 variableName
= ceeOne
.getVarname().toString();
854 // remove the '@' sign
855 variableName
= variableName
.substring(1); //** if this fails, then the user only put in the '@'
856 variableName
= variableName
.trim();
860 // retrieve from the bkell environments
861 IMemory memory
= (IMemory
)this.getBkellEnv().findMemoryById("main.memory");
862 if(variableName
.equals("memory")) {
864 HashMap allPrefixes
= new HashMap();
866 ISystem system
= BookkeepingSystem
.instance().getMODEL();
867 while(system
.canPull()) {
869 eachbob
= system
.pullNext();
870 allPrefixes
.putAll(eachbob
.getPrefixMappings());
872 memory
.setPrefixMappings(allPrefixes
);
877 IVariable variable
= memory
.findVariableByName(variableName
);
878 updatee
= (IBob
)variable
.getChildren().get(0);
884 logger
.debug("Grrr 4");
886 // 3. for function result
887 updatee
= ((IResult
)this.getPreviousCommandResult().getReference()).getChild(0);
890 logger
.debug("caseAUpdateCommand1 updatee 1: "+ updatee
.toXML(false));
891 if(updatee
instanceof IResult
) {
892 logger
.debug("here 1");
893 updatee
= updatee
.getChild(0);
896 logger
.debug("caseAUpdateCommand1 updatee 2: "+ updatee
.toXML(false));
897 originalTagId
= updatee
.getAttributeValue("id");
900 if(node
.getRbdepth2() != null)
902 node
.getRbdepth2().apply(this);
904 if(node
.getC2() != null)
907 logger
.debug("Grrr 5");
910 boolean xmlInput2
= false;
911 boolean varInput2
= false;
912 AVarCommandInput ceeTwo
= null;
913 if(node
.getC2() instanceof AXmlCommandInput
) {
916 else if(node
.getC2() instanceof AVarCommandInput
) {
918 ceeTwo
= (AVarCommandInput
)node
.getC2();
922 node
.getC2().apply(this);
925 IResult result
= CreateHelper
.execute(user
, new CreateCommand(), (AXmlCommandInput
)node
.getC2());
927 updator
= (IBob
)result
.allChildren().get(0);
930 logger
.debug("caseAUpdateCommand1 ZING 2!!!! " + updatee
.toXML(false));
933 else if( varInput2
) {
935 logger
.debug("caseAUpdateCommand1 ZING 3!!!!");
936 updator
= this.getPreviousCommandResult().getReference();
940 logger
.debug("Grrr 6");
942 // ** replace variable in mem if applicable
945 logger
.debug("Grrr 7");
946 logger
.debug("caseAUpdateCommand1 ZING 4!!!! A. / "+ ((IMemory
)this.getBkellEnv().findMemoryById("main.memory"))
947 .findVariableByName(variableName
).find(updatee
.getTagName(), originalTagId
) );
949 logger
.debug("caseAUpdateCommand1 ZING 4!!!! B. / updatee: "+ updatee
);
950 logger
.debug("caseAUpdateCommand1 ZING 4!!!! D. / tagName["+updatee
.getTagName()+"] / originalId["+originalTagId
+"]");
952 logger
.debug("caseAUpdateCommand1 ZING 4!!!! E. / to replace: "+ ((IMemory
)this.getBkellEnv().findMemoryById("main.memory")).findVariableByName(variableName
));
954 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory"))
955 .findVariableByName(variableName
).replace(updatee
.getTagName(), originalTagId
, updator
);
960 if(node
.getRbdepth1() != null)
962 node
.getRbdepth1().apply(this);
964 outAUpdateCommand1(node
);
966 // setting the 'previousCommandResult'
967 AXmlCommandInput replacor
= LoadHelper
.reparse(updatee
.toXML(false));
968 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
969 replacorReference
.setXmlCommandInput(replacor
);
970 replacorReference
.setReference(updatee
);
971 this.setPreviousCommandResult(replacorReference
);
975 public void caseARemoveCommand1(ARemoveCommand1 node
) {
979 String variableName
= null;
980 boolean varInput
= false;
981 AVarCommandInput ceeOne
= null;
982 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
983 String originalTagId
= null;
985 inARemoveCommand1(node
);
986 if(node
.getRemove() != null) {
987 node
.getRemove().apply(this);
989 if(node
.getLbdepth1() != null) {
990 node
.getLbdepth1().apply(this);
992 if(node
.getLbdepth2() != null) {
993 node
.getLbdepth2().apply(this);
995 if(node
.getCommandInput() != null) {
997 logger
.debug(">> remove / varInput["+ (node
.getCommandInput() instanceof AVarCommandInput
) +"]");
998 logger
.debug(">> remove / class["+ node
.getCommandInput().getClass() +"]");
999 if(node
.getCommandInput() instanceof AVarCommandInput
) {
1002 ceeOne
= (AVarCommandInput
)node
.getCommandInput();
1004 //ceeOne.getVarname().apply(this);
1005 variableName
= ceeOne
.getVarname().toString();
1007 // remove the '@' sign
1008 variableName
= variableName
.substring(1); //** if this fails, then the user only put in the '@'
1009 variableName
= variableName
.trim();
1011 logger
.debug(">> remove / varName["+ variableName
+"]");
1016 node
.getCommandInput().apply(this);
1019 * The Token Acceptor
1021 * IMPORTANT. XML, Options, or Command will be the input option
1022 * [X] i. The Command will be processed in the visitor.
1023 * [OK] ii. and the XML should be processed (not loaded)
1024 * [OK] iii. We do want to process the Options though
1026 node
.getCommandInput().apply(this);
1027 if(node
.getCommandInput() instanceof AXmlCommandInput
) {
1029 // if the input was raw XML, reparse into Bob object
1030 IResult result
= CreateHelper
.execute(user
, new CreateCommand(), (AXmlCommandInput
)node
.getCommandInput());
1031 removee
= (IBob
)result
.getChild(0);
1035 removee
= this.getPreviousCommandResult().getReference();
1038 originalTagId
= removee
.getAttributeValue("id");
1041 if(node
.getRbdepth2() != null) {
1042 node
.getRbdepth2().apply(this);
1048 VisitorApplyRemove vremove
= new VisitorApplyRemove();
1049 vremove
.setUser(user
);
1050 vremove
.setRemovee(removee
);
1052 //logger.debug("HERE REMOVE: 4");
1054 //** process list of inputs...
1055 List
<PIlist
> copy
= new ArrayList
<PIlist
>(node
.getIlist());
1056 for(PIlist e
: copy
) {
1060 //** now remove the gear
1067 //logger.debug(">> main memory: "+ ((IMemory)this.getBkellEnv().findMemoryById("main.memory")) );
1068 logger
.debug(">> variable name ["+ variableName
+"] / variable ["+ ((IMemory
)this.getBkellEnv().findMemoryById("main.memory"))
1069 .findVariableByName(variableName
) +"]");
1071 ((IMemory
)this.getBkellEnv().findMemoryById("main.memory"))
1072 .findVariableByName(variableName
).replace(removee
.getTagName(), originalTagId
, removee
);
1078 if(node
.getRbdepth1() != null) {
1079 node
.getRbdepth1().apply(this);
1081 outARemoveCommand1(node
);
1083 //logger.debug("Remove: THE END ["+removee+"]");
1086 // setting the 'previousCommandResult'
1087 AXmlCommandInput replacor
= LoadHelper
.reparse(removee
.toXML(false));
1088 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
1089 replacorReference
.setXmlCommandInput(replacor
);
1090 replacorReference
.setReference(removee
);
1091 this.setPreviousCommandResult(replacorReference
);
1097 public void caseAReverseCommand5(AReverseCommand5 node
) {
1100 IBob parentReversee
= null;
1101 IBob reversee
= null;
1102 IBob reversor
= null;
1104 IResult result
= null;
1106 inAReverseCommand5(node
);
1107 if(node
.getReverse() != null) {
1109 node
.getReverse().apply(this);
1111 if(node
.getLbdepth1() != null) {
1113 node
.getLbdepth1().apply(this);
1115 if(node
.getLbdepth2() != null){
1117 node
.getLbdepth2().apply(this);
1119 if(node
.getCi1() != null){
1122 node
.getCi1().apply(this);
1123 //parentReversee = this._addRemoveReverseLoadBlock(node.getCi1());
1124 parentReversee
= this.getPreviousCommandResult().getReference();
1127 if(node
.getRbdepth2() != null){
1129 node
.getRbdepth2().apply(this);
1131 if(node
.getLbdepth3() != null){
1133 node
.getLbdepth3().apply(this);
1135 if(node
.getCi2() != null){
1138 node
.getCi2().apply(this);
1139 reversee
= this._addRemoveReverseLoadBlock(node
.getCi2());
1142 if(node
.getRbdepth3() != null){
1144 node
.getRbdepth3().apply(this);
1146 if(node
.getCi3() != null){
1149 node
.getCi3().apply(this);
1150 reversor
= this._addRemoveReverseLoadBlock(node
.getCi3());
1152 ITokenLiterals tliterals
= new GTokenLiterals();
1153 tliterals
.addChild(reversor
);
1155 ReverseCommand rcommand
= new ReverseCommand();
1156 rcommand
.setTokenRecieverParent((IEntries
)parentReversee
);
1157 rcommand
.setTokenReciever(reversee
);
1158 rcommand
.setTokenLiterals(tliterals
);
1160 IUser user
= new User();
1162 user
.setUsername("root");
1163 this.aauthentication
.authenticate("webkell", user
);
1164 result
= rcommand
.execute(user
);
1167 if(node
.getRbdepth1() != null){
1169 node
.getRbdepth1().apply(this);
1171 outAReverseCommand5(node
);
1173 IBob bobResult
= (IBob
)result
.getChildren().get(0);
1174 //logger.debug("Reverse: THE END ["+ bobResult +"]");
1177 // setting the 'previousCommandResult'
1178 AXmlCommandInput replacor
= LoadHelper
.reparse(bobResult
.toXML(false));
1179 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
1180 replacorReference
.setXmlCommandInput(replacor
);
1181 replacorReference
.setReference(bobResult
);
1182 this.setPreviousCommandResult(replacorReference
);
1189 public void caseAFindCommand2(AFindCommand2 node
) {
1192 IBob findContext
= null;
1193 IBob bobResult
= null;
1194 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
1196 inAFindCommand2(node
);
1197 if(node
.getFind() != null) {
1198 node
.getFind().apply(this);
1200 if(node
.getLbdepth1() != null) {
1201 node
.getLbdepth1().apply(this);
1203 if(node
.getLbdepth2() != null) {
1204 node
.getLbdepth2().apply(this);
1206 if(node
.getC1() != null) {
1209 node
.getC1().apply(this);
1210 findContext
= this.getPreviousCommandResult().getReference();
1213 if(node
.getRbdepth2() != null) {
1214 node
.getRbdepth2().apply(this);
1216 if(node
.getC2() != null) {
1218 boolean isOptions
= (node
.getC2().getClass() == AOptsCommandInput
.class);
1221 node
.getC2().apply(this);
1226 FindCommand fcommand
= new FindCommand();
1227 fcommand
.setTokenReciever(findContext
);
1229 CommandOptionVisitor covisitor
= new CommandOptionVisitor();
1230 covisitor
.setCommand(fcommand
);
1231 node
.getC2().apply(covisitor
);
1234 //Logger.getLogger("bobstate").debug(loadCommand);
1236 bobResult
= fcommand
.execute(user
);
1241 // if we are dealing with XML
1243 IBob findor
= this._addRemoveReverseLoadBlock(node
.getC2());
1245 logger
.debug("findee ["+findContext
+"]");
1246 logger
.debug("findor ["+findor
+"]");
1248 //--> load this 'tliteral' xml from system
1249 FindVisitor fvisitor
= new FindVisitor();
1250 fvisitor
.setTagName(
1255 findContext
.accept(fvisitor
);
1258 List presults
= fvisitor
.getPossibleResults();
1259 List presults2
= new FindCommand().isolateSearchList( //** TODO - this is really bad, but I need the isolate function
1260 findor
.getAttributes()
1263 //logger.debug("WARNING. These are possible results. Returning first one");
1264 //logger.debug(presults2);
1266 if(presults2
.size() > 0) {
1268 bobResult
= (IBob
)presults2
.get(0);
1274 if(node
.getRbdepth1() != null) {
1275 node
.getRbdepth1().apply(this);
1277 outAFindCommand2(node
);
1279 //logger.debug("Find: THE END ["+ result +"]");
1282 // setting the 'previousCommandResult'
1283 AXmlCommandInput replacor
= LoadHelper
.reparse(bobResult
.toXML(false));
1284 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
1285 replacorReference
.setXmlCommandInput(replacor
);
1286 replacorReference
.setReference(bobResult
);
1287 this.setPreviousCommandResult(replacorReference
);
1292 public void caseAListCommand2(AListCommand2 node
) {
1296 IResult result
= new GResult();
1298 inAListCommand2(node
);
1299 if(node
.getList() != null) {
1300 node
.getList().apply(this);
1302 if(node
.getLbdepth1() != null) {
1303 node
.getLbdepth1().apply(this);
1305 if(node
.getLbdepth2() != null) {
1306 node
.getLbdepth2().apply(this);
1308 if(node
.getC1() != null) {
1311 node
.getC1().apply(this);
1312 //listee = this._addRemoveReverseLoadBlock(node.getC1());
1313 listee
= this.getPreviousCommandResult().getReference();
1316 if(node
.getRbdepth2() != null) {
1317 node
.getRbdepth2().apply(this);
1319 if(node
.getC2() != null) {
1322 node
.getC2().apply(this);
1324 IBob listor
= this._addRemoveReverseLoadBlock(node
.getC2());
1325 //logger.debug("listee ["+listee+"]");
1326 //logger.debug("listor ["+listor+"]");
1328 //--> load this 'tliteral' xml from system
1329 FindVisitor fvisitor
= new FindVisitor();
1330 fvisitor
.setTagName(
1335 listee
.accept(fvisitor
);
1338 List presults
= fvisitor
.getPossibleResults();
1341 //logger.debug("ExpressionVisitor.caseAListCommand2: BEFORE isolate / Attribute size["+listor.getAttributes().getLength()+"]");
1342 //logger.debug(presults);
1344 if(listor
.getAttributes().getLength() > 0) {
1346 presults
= new FindCommand().isolateSearchList( //** this is really bad, but I need the isolate function
1347 listor
.getAttributes()
1352 //logger.debug("ExpressionVisitor.caseAListCommand2: WARNING. These are possible results. Returning first one");
1353 //logger.debug(presults);
1355 if(presults
.size() > 0) {
1357 result
.addChildren(presults
);
1362 if(node
.getRbdepth1() != null) {
1363 node
.getRbdepth1().apply(this);
1365 outAListCommand2(node
);
1367 //logger.debug("List: THE END ["+ result +"]");
1370 // setting the 'previousCommandResult'
1371 IBob bobResult
= (IBob
)result
.getChildren().get(0);
1372 AXmlCommandInput replacor
= LoadHelper
.reparse(bobResult
.toXML(false));
1373 AXmlCommandInputRef replacorReference
= new AXmlCommandInputRef();
1374 replacorReference
.setXmlCommandInput(replacor
);
1375 replacorReference
.setReference(bobResult
);
1376 this.setPreviousCommandResult(replacorReference
);
1381 public void caseAExitCommand4(AExitCommand4 node
) {
1383 inAExitCommand4(node
);
1384 if(node
.getExit() != null) {
1385 node
.getExit().apply(this);
1388 //** turn off this visitor's switch
1389 this.setActive(false);
1390 outAExitCommand4(node
);
1394 private IBob
_createBlock(Node cinput
) {
1398 CreateCommand createCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CreateCommand
)
1399 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
1401 if(this.userSession
== null) {
1402 throw new AuthorisationException("You are not logged in");
1404 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
1405 IResult addee_r
= CreateHelper
.execute(user
, createCommand
, (AXmlCommandInput
)cinput
);
1406 List addeeList
= addee_r
.allChildren();
1407 bobee
= (IBob
)addeeList
.get(0);
1412 private IBob
_addRemoveReverseLoadBlock(PCommandInput cinput
) {
1417 LoadCommand loadCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.LoadCommand
)
1418 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.LoadCommand" );
1419 CreateCommand createCommand
= (com
.interrupt
.bookkeeping
.cc
.bkell
.command
.CreateCommand
)
1420 Bob
.make( "com.interrupt.bookkeeping.cc.bkell.command.CreateCommand" );
1422 if(cinput
instanceof AXmlCommandInput
) {
1424 if(this.userSession
== null) {
1425 throw new AuthorisationException("You are not logged in");
1427 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
1428 IResult addee_r
= CreateHelper
.execute(user
, createCommand
, (AXmlCommandInput
)cinput
);
1429 List addeeList
= addee_r
.allChildren();
1430 bobee
= (IBob
)addeeList
.get(0);
1433 else if(cinput
instanceof AOptsCommandInput
) {
1435 if(this.userSession
== null) {
1436 throw new AuthorisationException("You are not logged in");
1438 IUser user
= this.aauthentication
.findUser(this.userSession
.getUserid());
1439 IResult addee_r
= LoadHelper
.execute(user
, loadCommand
, (AOptsCommandInput
)cinput
);
1440 List addeeList
= addee_r
.allChildren();
1441 bobee
= (IBob
)addeeList
.get(0);
1449 public static void main(String args
[]) {
1453 Bob bob
= new Bob();
1454 (System
.getProperties()).setProperty("bob.gen", "gen/");
1455 (System
.getProperties()).setProperty("bob.base", ".");
1458 //logger.debug("HERE 1");
1460 String input_s
= "< account xmlns = ' com / interrupt / bookkeeping / account ' id = ' 1 ' name = ' office equipment ' type = ' asset ' counterWeight = ' debit ' > < debit xmlns = ' com / interrupt / bookkeeping / account ' id = ' ' amount = ' 10.00 ' entryid = ' ' accountid = ' 1 ' / > < / account >";
1461 String input_1
= input_s
.replaceAll("< ", "<");
1462 String input_2
= input_1
.replaceAll("\\/ >", "/>");
1463 String input_x
= input_2
.replaceAll("< \\/", "</");
1464 String input_y
= input_x
.replaceAll("<\\/ ", "</");
1465 String input_xx
= input_y
.replaceAll(" \\/ ", "/");
1466 String input_3
= input_xx
.replaceAll(" = ", "=");
1468 //String input_3 = "<account xmlns = 'com/interrupt/bookkeeping/account' id = ' 1 ' name = ' office equipment ' type = ' asset ' counterWeight = ' debit ' > <debit xmlns = 'com/interrupt/bookkeeping/account' id = ' ' amount = ' 10.00 ' entryid = ' ' accountid = ' 1 ' /> </account>";
1470 //logger.debug("HERE 2 ["+ input_3 +"]");
1472 IBob created
= bob
.load( input_3
, "xml/bookkeeping.system.xml" );
1473 //IBob created = bob.load( "<account xmlns='com/interrupt/bookkeeping/account' id='1' name='office equipment' type='asset' counterWeight='debit' > <debit xmlns='com/interrupt/bookkeeping/account' id='' amount='10.00' entryid='' accountid = ' 1 ' /> </account>",
1474 // "xml/bookkeeping.2.bookkeeping.xml xml/bookkeeping.2.transactions.xml xml/bookkeeping.2.users.xml" );
1478 //logger.debug("HERE 3");
1480 //created.toXML(System.out);
1487 * return XMLCommandInput from these commands
1489 public void caseAC1Command(AC1Command node
) {
1492 if(node
.getCommand1() != null) {
1493 node
.getCommand1().apply(this);
1495 outAC1Command(node
);
1499 public void caseAC2Command(AC2Command node
) {
1502 if(node
.getCommand2() != null) {
1503 node
.getCommand2().apply(this);
1505 outAC2Command(node
);
1509 public void caseAC5Command(AC5Command node
) {
1512 if(node
.getCommand5() != null) {
1513 node
.getCommand5().apply(this);
1515 outAC5Command(node
);
1518 public void caseAC3Command(AC3Command node
) {
1521 if(node
.getCommand3() != null) {
1522 node
.getCommand3().apply(this);
1524 outAC3Command(node
);
1527 public void caseAC4Command(AC4Command node
) {
1530 if(node
.getCommand4() != null) {
1531 node
.getCommand4().apply(this);
1533 outAC4Command(node
);