Source Code Cross Referenced for Proxy.java in  » Scripting » oscript-2.10.4 » oscript » data » 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 » Scripting » oscript 2.10.4 » oscript.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*=============================================================================
002:         *     Copyright Texas Instruments 2003-2004.  All Rights Reserved.
003:         *   
004:         * This program is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         * 
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         * 
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package oscript.data;
020:
021:        import oscript.exceptions.*;
022:        import oscript.classwrap.ClassWrapGen;
023:        import oscript.syntaxtree.FunctionCallExpressionList;
024:        import oscript.OscriptInterpreter;
025:        import oscript.NodeEvaluator;
026:
027:        import java.util.*;
028:
029:        /**
030:         * A proxy object acts as a proxy, all attempts to resolve a member go
031:         * thru the <code>resolve</code> method which should be implemented by
032:         * the derived script class.
033:         * 
034:         * @author Rob Clark (rob@ti.com)
035:         */
036:        public class Proxy extends OObject {
037:            /**
038:             * The type object for an instance of Proxy.
039:             */
040:            public final static Value TYPE = BuiltinType
041:                    .makeBuiltinType("oscript.data.Proxy");
042:            public final static String PARENT_TYPE_NAME = "oscript.data.OObject";
043:            public final static String TYPE_NAME = "Proxy";
044:            public final static String[] MEMBER_NAMES = new String[] { "getTypeMember" };
045:
046:            /**
047:             * Class Constructor.
048:             */
049:            public Proxy() {
050:                super ();
051:            }
052:
053:            /**
054:             * Class Constructor.  This is the constructor that gets called via an
055:             * BuiltinType instance.
056:             * 
057:             * @param args         arguments to this constructor
058:             * @throws PackagedScriptObjectException(Exception) if wrong number of args
059:             */
060:            public Proxy(oscript.util.MemberTable args) {
061:                this ();
062:
063:                if (args.length() != 0)
064:                    throw PackagedScriptObjectException
065:                            .makeExceptionWrapper(new OIllegalArgumentException(
066:                                    "wrong number of args!"));
067:            }
068:
069:            /**
070:             * Get the type of this object.  The returned type doesn't have to take
071:             * into account the possibility of a script type extending a built-in
072:             * type, since that is handled by {@link #getType}.
073:             * 
074:             * @return the object's type
075:             */
076:            protected Value getTypeImpl() {
077:                return TYPE;
078:            }
079:
080:            /**
081:             * Get a member of this type.  This uses the resolve() method implemented
082:             * by the derived script class to help resolve members.
083:             * 
084:             * @param obj          an object of this type
085:             * @param id           the id of the symbol that maps to the member
086:             * @return a reference to the member, or null
087:             */
088:            protected Value getTypeMember(Value obj, int id) {
089:                Value name = Symbol.getSymbol(id);
090:                Value val = null;
091:
092:                Thread currentThread = Thread.currentThread();
093:                if (!recursedSet.contains(currentThread)) {
094:                    try {
095:                        recursedSet.add(currentThread);
096:                        Value resolve = obj.getMember(RESOLVE, false);
097:                        if (resolve != null)
098:                            val = resolve.callAsFunction(new Value[] { name });
099:                    } finally {
100:                        recursedSet.remove(currentThread);
101:                    }
102:                }
103:
104:                if (val != null)
105:                    return val;
106:
107:                return super .getTypeMember(obj, id);
108:            }
109:
110:            private Set recursedSet = new HashSet();
111:
112:            private static final int RESOLVE = Symbol.getSymbol("resolve")
113:                    .getId();
114:
115:        }
116:
117:        /*
118:         *   Local Variables:
119:         *   tab-width: 2
120:         *   indent-tabs-mode: nil
121:         *   mode: java
122:         *   c-indentation-style: java
123:         *   c-basic-offset: 2
124:         *   eval: (c-set-offset 'substatement-open '0)
125:         *   eval: (c-set-offset 'case-label '+)
126:         *   eval: (c-set-offset 'inclass '+)
127:         *   eval: (c-set-offset 'inline-open '0)
128:         *   End:
129:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.