Source Code Cross Referenced for AXInterpretator.java in  » XML » activexml » org » xdev » base » core » vm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » activexml » org.xdev.base.core.vm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Mar 31, 2004
003:         *
004:         * To change the template for this generated file go to
005:         * Window>Preferences>Java>Code Generation>Code and Comments
006:         */
007:        package org.xdev.base.core.vm;
008:
009:        import java.io.BufferedReader;
010:        import java.io.File;
011:        import java.io.InputStreamReader;
012:
013:        import org.xdev.base.core.BASE;
014:        import org.xdev.base.core.IPage;
015:        import org.xdev.base.core.compiler.AXCompiler;
016:        import org.xdev.base.xssl.XSSLAction;
017:        import org.xdev.base.xssl.XSSLReturn;
018:        import org.xdev.base.log.LoggerWriter;
019:
020:        import org.apache.log4j.*;
021:
022:        /**
023:         * @author AYegorov
024:         *
025:         * To change the template for this generated type comment go to
026:         * Window>Preferences>Java>Code Generation>Code and Comments
027:         */
028:        public class AXInterpretator implements  IPage {
029:            private AXCompiler compiler = null;
030:
031:            private Logger logger = Logger.getLogger(this .getClass().getName());
032:
033:            private String rulePath = null;
034:
035:            private File ruleFile = null;
036:
037:            private XSSLAction action = null;
038:
039:            private static String[] arguments = null;
040:
041:            /**
042:             * 
043:             */
044:            public AXInterpretator(String rulePath) throws Exception {
045:                this .ruleFile = BASE.getFile(rulePath, this .getClass());
046:
047:                this .rulePath = rulePath;
048:
049:                this .compiler = AXCompiler.getInstance(System
050:                        .getProperty(AXCompiler.BASE_CONFIG), this );
051:            }
052:
053:            public static void main(String[] args) {
054:                try {
055:
056:                    arguments = args;
057:
058:                    String ruleUrl = null;
059:
060:                    if (args.length > 0) {
061:                        ruleUrl = args[0];
062:
063:                        for (int i = 0; i < args.length; i++) {
064:                            AXCompiler.addArgument(args[i]);
065:                        }
066:                    } else {
067:
068:                        System.out.print("Enter relative rule url: ");
069:
070:                        StringBuffer buffer = new StringBuffer();
071:
072:                        String line = null;
073:
074:                        BufferedReader reader = new BufferedReader(
075:                                new InputStreamReader(System.in));
076:
077:                        if ((line = reader.readLine()) != null) {
078:
079:                            if ("quit".equalsIgnoreCase(line)) {
080:                                System.exit(0);
081:                            }
082:
083:                            ruleUrl = line;
084:                        }
085:
086:                        AXCompiler.addArgument(ruleUrl);
087:                    }
088:
089:                    if (ruleUrl != null) {
090:
091:                        AXInterpretator interpreter = new AXInterpretator(
092:                                ruleUrl);
093:
094:                        LoggerWriter.log(interpreter.evaluate(),
095:                                Level.INFO_INT, AXInterpretator.class);
096:                    } else {
097:                        System.out.println("No rule to execute");
098:                    }
099:                } catch (Exception ex) {
100:
101:                    LoggerWriter.log(BASE.getValueFromObject(ex),
102:                            Level.FATAL_INT, AXInterpretator.class);
103:                }
104:            }
105:
106:            public Object evaluate() throws Exception {
107:                Object obj = null;
108:
109:                this .action = this .compiler.compileRule(this , this .ruleFile,
110:                        this .rulePath);
111:
112:                this .action.start();
113:
114:                while (this .action.isAlive()) {
115:                    Thread.sleep(200);
116:                }
117:
118:                if (this .action instanceof  XSSLReturn) {
119:                    obj = ((XSSLReturn) this .action).getObjectValue();
120:                }
121:
122:                return obj;
123:            }
124:
125:            public String getType(String xmlTag) {
126:                return this .compiler.getType(xmlTag).getType().getName();
127:            }
128:
129:            public Logger getLogger() {
130:                return this .logger;
131:            }
132:
133:            public String getLoggerId() {
134:                return this .getClass().getName();
135:            }
136:
137:            public String getName() {
138:                return "interpreter";
139:            }
140:
141:            public Object getTransactionController() {
142:                return this ;
143:            }
144:
145:            public Object getTransactionRequest() {
146:                return System.getProperties();
147:            }
148:
149:            public Object getTransactionResponse() {
150:                return null;
151:            }
152:
153:            public Object getTransactionConfig() {
154:                return null;
155:            }
156:
157:            public Object getTransactionAction() {
158:                return this ;
159:            }
160:
161:            public Object getParentTransaction() {
162:                return null;
163:            }
164:
165:            /**
166:             * @param i
167:             * @return
168:             */
169:            public Object getArgument(int i) {
170:                return AXInterpretator.arguments[i];
171:            }
172:
173:            /* (non-Javadoc)
174:             * @see org.xdev.base.core.IPage#getTransactionSession()
175:             */
176:            public Object getTransactionSession() {
177:                // XXX Auto-generated method stub
178:                return null;
179:            }
180:
181:            /* (non-Javadoc)
182:             * @see org.xdev.base.core.IPage#getWorkingDirectory()
183:             */
184:            public String getWorkingDirectory() {
185:                return System.getProperty("user.dir");
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.