Source Code Cross Referenced for IDLType.java in  » Collaboration » JacORB » org » jacorb » ir » 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 » Collaboration » JacORB » org.jacorb.ir 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.jacorb.ir;
002:
003:        /*
004:         *        JacORB - a free Java ORB
005:         *
006:         *   Copyright (C) 1997-2004 Gerald Brose.
007:         *
008:         *   This library is free software; you can redistribute it and/or
009:         *   modify it under the terms of the GNU Library General Public
010:         *   License as published by the Free Software Foundation; either
011:         *   version 2 of the License, or (at your option) any later version.
012:         *
013:         *   This library is distributed in the hope that it will be useful,
014:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         *   Library General Public License for more details.
017:         *
018:         *   You should have received a copy of the GNU Library General Public
019:         *   License along with this library; if not, write to the Free
020:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021:         */
022:
023:        import org.omg.CORBA.TypeCode;
024:        import org.omg.CORBA.TCKind;
025:        import org.omg.PortableServer.POA;
026:
027:        import org.apache.avalon.framework.logger.Logger;
028:
029:        /**
030:         * Base class and factory for anonymous IDLType objects
031:         * 
032:         * Direct instances of this class are only used as place holders
033:         * in recursive types
034:         */
035:
036:        public class IDLType extends IRObject implements 
037:                org.omg.CORBA.IDLTypeOperations {
038:            protected org.omg.CORBA.TypeCode type;
039:
040:            public org.omg.CORBA.TypeCode type() {
041:                return type;
042:            }
043:
044:            public void define() {
045:            }
046:
047:            public void destroy() {
048:            }
049:
050:            protected IDLType() {
051:            }
052:
053:            private IDLType(TypeCode tc, org.omg.CORBA.Repository ir) {
054:                type = tc;
055:            }
056:
057:            /**
058:             * Factory method for IDLType objects
059:             */
060:            public static org.omg.CORBA.IDLType create(TypeCode tc,
061:                    org.omg.CORBA.Repository ir, Logger logger, POA poa) {
062:                return create(tc, ir, false, logger, poa);
063:            }
064:
065:            public static org.omg.CORBA.IDLType create(TypeCode tc,
066:                    org.omg.CORBA.Repository ir, boolean define, Logger logger,
067:                    POA poa) {
068:                if (logger.isDebugEnabled()) {
069:                    logger.debug("IDLType create for tc kind "
070:                            + tc.kind().value());
071:                }
072:
073:                if (tc == null) // PIDLs
074:                    return null;
075:
076:                if (org.jacorb.orb.TypeCode.isRecursive(tc)) {
077:                    logger.debug("Placeholder for recursive sequence");
078:
079:                    try {
080:                        return org.omg.CORBA.IDLTypeHelper
081:                                .narrow(poa
082:                                        .servant_to_reference(new org.omg.CORBA.IDLTypePOATie(
083:                                                new IDLType(tc, ir))));
084:                    } catch (Exception e) {
085:                        logger.error("Caught Exception", e);
086:                    }
087:                }
088:
089:                int kind = tc.kind().value();
090:
091:                switch (kind) {
092:                case TCKind._tk_null:
093:                case TCKind._tk_void:
094:                case TCKind._tk_short:
095:                case TCKind._tk_long:
096:                case TCKind._tk_ushort:
097:                case TCKind._tk_ulong:
098:                case TCKind._tk_float:
099:                case TCKind._tk_double:
100:                case TCKind._tk_boolean:
101:                case TCKind._tk_char:
102:                case TCKind._tk_longlong:
103:                case TCKind._tk_ulonglong:
104:                case TCKind._tk_longdouble:
105:                case TCKind._tk_wchar:
106:                case TCKind._tk_octet:
107:                case TCKind._tk_any:
108:                case TCKind._tk_TypeCode:
109:                case TCKind._tk_Principal:
110:                    try {
111:                        PrimitiveDef pd = new PrimitiveDef(tc);
112:                        return org.omg.CORBA.PrimitiveDefHelper
113:                                .narrow(poa
114:                                        .servant_to_reference(new org.omg.CORBA.PrimitiveDefPOATie(
115:                                                pd)));
116:                    } catch (Exception e) {
117:                        logger.error("Caught Exception", e);
118:                        return null;
119:                    }
120:                case TCKind._tk_alias:
121:                case TCKind._tk_struct:
122:                case TCKind._tk_except:
123:                case TCKind._tk_union:
124:                case TCKind._tk_enum:
125:                    try {
126:                        return org.omg.CORBA.IDLTypeHelper.narrow(ir
127:                                .lookup_id(tc.id()));
128:                    } catch (Exception e) {
129:                        // does not happen here
130:                        logger.error("Caught Exception", e);
131:                        return null;
132:                    }
133:                case TCKind._tk_string:
134:                    try {
135:                        if (tc.length() == 0) {
136:                            return org.omg.CORBA.PrimitiveDefHelper
137:                                    .narrow(poa
138:                                            .servant_to_reference(new org.omg.CORBA.PrimitiveDefPOATie(
139:                                                    new PrimitiveDef(tc))));
140:                        } else {
141:                            return org.omg.CORBA.StringDefHelper
142:                                    .narrow(poa
143:                                            .servant_to_reference(new org.omg.CORBA.StringDefPOATie(
144:                                                    new StringDef(tc))));
145:                        }
146:                    } catch (Exception e) {
147:                        logger.error("Caught Exception", e);
148:                        return null;
149:                    }
150:                case TCKind._tk_wstring:
151:                    try {
152:                        if (tc.length() == 0) {
153:                            return org.omg.CORBA.PrimitiveDefHelper
154:                                    .narrow(poa
155:                                            .servant_to_reference(new org.omg.CORBA.PrimitiveDefPOATie(
156:                                                    new PrimitiveDef(tc))));
157:                        } else {
158:                            return org.omg.CORBA.WstringDefHelper
159:                                    .narrow(poa
160:                                            .servant_to_reference(new org.omg.CORBA.WstringDefPOATie(
161:                                                    new WstringDef(tc))));
162:                        }
163:                    } catch (Exception e) {
164:                        logger.error("Caught Exception", e);
165:                        return null;
166:                    }
167:                case TCKind._tk_fixed:
168:                    try {
169:                        return org.omg.CORBA.FixedDefHelper
170:                                .narrow(poa
171:                                        .servant_to_reference(new org.omg.CORBA.FixedDefPOATie(
172:                                                new FixedDef(tc))));
173:                    } catch (Exception e) {
174:                        logger.error("Caught Exception", e);
175:                        return null;
176:                    }
177:                case TCKind._tk_objref: {
178:                    try {
179:                        if (logger.isDebugEnabled()) {
180:                            logger.debug("IDLType create for " + tc.id());
181:                        }
182:
183:                        if (tc.id().equals("IDL:omg.org/CORBA/Object:1.0")) {
184:                            return org.omg.CORBA.PrimitiveDefHelper
185:                                    .narrow(poa
186:                                            .servant_to_reference(new org.omg.CORBA.PrimitiveDefPOATie(
187:                                                    new PrimitiveDef(tc))));
188:                        } else {
189:                            return org.omg.CORBA.IDLTypeHelper.narrow(ir
190:                                    .lookup_id(tc.id()));
191:                        }
192:                    } catch (Exception e) {
193:                        logger.error("Caught Exception", e);
194:                        return null;
195:                    }
196:                }
197:                case TCKind._tk_sequence:
198:                    try {
199:                        SequenceDef sd = new SequenceDef(tc, ir, logger, poa);
200:                        if (define)
201:                            sd.define();
202:                        return org.omg.CORBA.SequenceDefHelper
203:                                .narrow(poa
204:                                        .servant_to_reference(new org.omg.CORBA.SequenceDefPOATie(
205:                                                sd)));
206:                    } catch (Exception e) {
207:                        logger.error("Caught Exception", e);
208:                        return null;
209:                    }
210:                case TCKind._tk_array:
211:                    try {
212:                        ArrayDef ad = new ArrayDef(tc, ir, logger, poa);
213:                        if (define)
214:                            ad.define();
215:                        return org.omg.CORBA.ArrayDefHelper
216:                                .narrow(poa
217:                                        .servant_to_reference(new org.omg.CORBA.ArrayDefPOATie(
218:                                                ad)));
219:                    } catch (Exception e) {
220:                        logger.error("Caught Exception", e);
221:                        return null;
222:                    }
223:                default:
224:                    logger.warn("IDL type returns null for tc kind " + kind);
225:                    return null;
226:                }
227:            }
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.