Source Code Cross Referenced for RmiDebugModelImpl.java in  » Template-Engine » freemarker-2.3.10 » freemarker » debug » impl » 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 » Template Engine » freemarker 2.3.10 » freemarker.debug.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package freemarker.debug.impl;
002:
003:        import java.rmi.RemoteException;
004:        import java.rmi.server.UnicastRemoteObject;
005:        import java.util.ArrayList;
006:        import java.util.Date;
007:        import java.util.List;
008:
009:        import freemarker.debug.DebugModel;
010:        import freemarker.template.TemplateBooleanModel;
011:        import freemarker.template.TemplateCollectionModel;
012:        import freemarker.template.TemplateDateModel;
013:        import freemarker.template.TemplateHashModel;
014:        import freemarker.template.TemplateHashModelEx;
015:        import freemarker.template.TemplateMethodModel;
016:        import freemarker.template.TemplateMethodModelEx;
017:        import freemarker.template.TemplateModel;
018:        import freemarker.template.TemplateModelException;
019:        import freemarker.template.TemplateModelIterator;
020:        import freemarker.template.TemplateNumberModel;
021:        import freemarker.template.TemplateScalarModel;
022:        import freemarker.template.TemplateSequenceModel;
023:        import freemarker.template.TemplateTransformModel;
024:
025:        /**
026:         * @author Attila Szegedi
027:         * @version $Id: RmiDebugModelImpl.java,v 1.2.2.1 2006/11/27 07:54:49 szegedia Exp $
028:         */
029:        class RmiDebugModelImpl extends UnicastRemoteObject implements 
030:                DebugModel {
031:            private static final long serialVersionUID = 1L;
032:
033:            private final TemplateModel model;
034:            private final int type;
035:
036:            RmiDebugModelImpl(TemplateModel model, int extraTypes)
037:                    throws RemoteException {
038:                super ();
039:                this .model = model;
040:                type = calculateType(model) + extraTypes;
041:            }
042:
043:            private static DebugModel getDebugModel(TemplateModel tm)
044:                    throws RemoteException {
045:                return (DebugModel) RmiDebuggedEnvironmentImpl
046:                        .getCachedWrapperFor(tm);
047:            }
048:
049:            public String getAsString() throws TemplateModelException {
050:                return ((TemplateScalarModel) model).getAsString();
051:            }
052:
053:            public Number getAsNumber() throws TemplateModelException {
054:                return ((TemplateNumberModel) model).getAsNumber();
055:            }
056:
057:            public Date getAsDate() throws TemplateModelException {
058:                return ((TemplateDateModel) model).getAsDate();
059:            }
060:
061:            public int getDateType() {
062:                return ((TemplateDateModel) model).getDateType();
063:            }
064:
065:            public boolean getAsBoolean() throws TemplateModelException {
066:                return ((TemplateBooleanModel) model).getAsBoolean();
067:            }
068:
069:            public int size() throws TemplateModelException {
070:                if (model instanceof  TemplateSequenceModel) {
071:                    return ((TemplateSequenceModel) model).size();
072:                }
073:                return ((TemplateHashModelEx) model).size();
074:            }
075:
076:            public DebugModel get(int index) throws TemplateModelException,
077:                    RemoteException {
078:                return getDebugModel(((TemplateSequenceModel) model).get(index));
079:            }
080:
081:            public DebugModel[] get(int fromIndex, int toIndex)
082:                    throws TemplateModelException, RemoteException {
083:                DebugModel[] dm = new DebugModel[toIndex - fromIndex];
084:                TemplateSequenceModel s = (TemplateSequenceModel) model;
085:                for (int i = fromIndex; i < toIndex; i++) {
086:                    dm[i - fromIndex] = getDebugModel(s.get(i));
087:                }
088:                return dm;
089:            }
090:
091:            public DebugModel[] getCollection() throws TemplateModelException,
092:                    RemoteException {
093:                List list = new ArrayList();
094:                TemplateModelIterator i = ((TemplateCollectionModel) model)
095:                        .iterator();
096:                while (i.hasNext()) {
097:                    list.add(getDebugModel(i.next()));
098:                }
099:                return (DebugModel[]) list.toArray(new DebugModel[list.size()]);
100:            }
101:
102:            public DebugModel get(String key) throws TemplateModelException,
103:                    RemoteException {
104:                return getDebugModel(((TemplateHashModel) model).get(key));
105:            }
106:
107:            public DebugModel[] get(String[] keys)
108:                    throws TemplateModelException, RemoteException {
109:                DebugModel[] dm = new DebugModel[keys.length];
110:                TemplateHashModel h = (TemplateHashModel) model;
111:                for (int i = 0; i < keys.length; i++) {
112:                    dm[i] = getDebugModel(h.get(keys[i]));
113:                }
114:                return dm;
115:            }
116:
117:            public String[] keys() throws TemplateModelException {
118:                TemplateHashModelEx h = (TemplateHashModelEx) model;
119:                List list = new ArrayList();
120:                TemplateModelIterator i = h.keys().iterator();
121:                while (i.hasNext()) {
122:                    list.add(((TemplateScalarModel) i.next()).getAsString());
123:                }
124:                return (String[]) list.toArray(new String[list.size()]);
125:            }
126:
127:            public int getModelTypes() {
128:                return type;
129:            }
130:
131:            private static int calculateType(TemplateModel model) {
132:                int type = 0;
133:                if (model instanceof  TemplateScalarModel)
134:                    type += TYPE_SCALAR;
135:                if (model instanceof  TemplateNumberModel)
136:                    type += TYPE_NUMBER;
137:                if (model instanceof  TemplateDateModel)
138:                    type += TYPE_DATE;
139:                if (model instanceof  TemplateBooleanModel)
140:                    type += TYPE_BOOLEAN;
141:                if (model instanceof  TemplateSequenceModel)
142:                    type += TYPE_SEQUENCE;
143:                if (model instanceof  TemplateCollectionModel)
144:                    type += TYPE_COLLECTION;
145:                if (model instanceof  TemplateHashModelEx)
146:                    type += TYPE_HASH_EX;
147:                else if (model instanceof  TemplateHashModel)
148:                    type += TYPE_HASH;
149:                if (model instanceof  TemplateMethodModelEx)
150:                    type += TYPE_METHOD_EX;
151:                else if (model instanceof  TemplateMethodModel)
152:                    type += TYPE_METHOD;
153:                if (model instanceof  TemplateTransformModel)
154:                    type += TYPE_TRANSFORM;
155:                return type;
156:            }
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.