Source Code Cross Referenced for Contained.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.*;
024:        import org.omg.PortableServer.POA;
025:
026:        import java.lang.reflect.*;
027:
028:        import org.apache.avalon.framework.logger.Logger;
029:
030:        /**
031:         * @version $Id: Contained.java,v 1.14 2006/10/11 20:33:00 iliyan.jeliazkov Exp $
032:         */
033:
034:        public abstract class Contained extends IRObject implements 
035:                org.omg.CORBA.ContainedOperations {
036:            protected String id;
037:
038:            /* IDL name from the root of the class path to the leaf */
039:            protected String absolute_name;
040:            /* from the root of the class path to the leaf */
041:            String full_name;
042:            protected String version = "1.0";
043:
044:            protected org.omg.CORBA.Container defined_in;
045:            protected org.omg.CORBA.Repository containing_repository;
046:
047:            private static Class intfClass;
048:            private static Class idlClass;
049:            private static Class stubClass;
050:            private static Class exceptClass;
051:            private static boolean class_init;
052:
053:            public Contained() {
054:            }
055:
056:            public Contained(String _id, String _name, String _version,
057:                    org.omg.CORBA.Container _defined_in, String _absolute_name,
058:                    org.omg.CORBA.Repository _containing_repository) {
059:                id = _id;
060:                name = _name;
061:                version = _version;
062:                defined_in = _defined_in;
063:                absolute_name = _absolute_name;
064:                containing_repository = _containing_repository;
065:            }
066:
067:            public static Contained createContained(Class c, String path,
068:                    org.omg.CORBA.Container _defined_in,
069:                    org.omg.CORBA.Repository ir, Logger logger,
070:                    ClassLoader loader, POA poa) {
071:                if (!class_init) {
072:                    try {
073:                        intfClass = loader.loadClass("org.omg.CORBA.Object");
074:                        idlClass = loader
075:                                .loadClass("org.omg.CORBA.portable.IDLEntity");
076:                        stubClass = loader
077:                                .loadClass("org.omg.CORBA.portable.ObjectImpl");
078:                        exceptClass = loader
079:                                .loadClass("org.omg.CORBA.UserException");
080:                        class_init = true;
081:                    } catch (ClassNotFoundException cnf) {
082:                        // debug:  cnf.printStackTrace();
083:                    }
084:                }
085:
086:                if (stubClass.isAssignableFrom(c)) {
087:                    return null; // don't care for stubs
088:                } else if (c.isInterface()) {
089:                    if (intfClass.isAssignableFrom(c)) {
090:                        try {
091:                            Class helperClass = loader.loadClass(c.getName()
092:                                    + "Helper");
093:
094:                            if (helperClass == null) {
095:                                return null;
096:                            }
097:
098:                            org.jacorb.ir.InterfaceDef idef = new org.jacorb.ir.InterfaceDef(
099:                                    c, helperClass, path, _defined_in, ir,
100:                                    loader, poa, logger);
101:
102:                            return idef;
103:                        } catch (ClassNotFoundException e) {
104:                            // debug: e.printStackTrace();
105:                            return null;
106:                        }
107:                    } else {
108:                        try {
109:                            Field f = c.getDeclaredField("value");
110:                            return new org.jacorb.ir.ConstantDef(c,
111:                                    _defined_in, ir, logger, poa);
112:                        } catch (NoSuchFieldException nsfe) {
113:                            //                    org.jacorb.util.Debug.output(2, nsfe );
114:                            return null;
115:                        }
116:                    }
117:                } else if (exceptClass.isAssignableFrom(c)) {
118:                    /*
119:                    try
120:                    {
121:                     */
122:                    return new org.jacorb.ir.ExceptionDef(c, _defined_in, ir,
123:                            loader, poa, logger);
124:                    /*
125:                    }
126:                    catch ( Exception e )
127:                    {
128:                    // debug:
129:                    e.printStackTrace();
130:                    return null;
131:                    }
132:                     */
133:                } else if (idlClass.isAssignableFrom(c)) {
134:                    try {
135:                        Class helperClass = loader.loadClass(c.getName()
136:                                + "Helper");
137:
138:                        org.omg.CORBA.TypeCode tc = (org.omg.CORBA.TypeCode) helperClass
139:                                .getDeclaredMethod("type", (Class[]) null)
140:                                .invoke(null, (java.lang.Object[]) null);
141:                        switch (tc.kind().value()) {
142:                        case org.omg.CORBA.TCKind._tk_struct:
143:                            return new org.jacorb.ir.StructDef(c, path,
144:                                    _defined_in, ir, logger, loader, poa);
145:                        case org.omg.CORBA.TCKind._tk_enum:
146:                            return new org.jacorb.ir.EnumDef(c, _defined_in,
147:                                    ir, loader);
148:                        case org.omg.CORBA.TCKind._tk_union:
149:                            return new org.jacorb.ir.UnionDef(c, path,
150:                                    _defined_in, ir, loader, logger, poa);
151:                        default:
152:                            return null;
153:                        }
154:                    } catch (ClassNotFoundException e) {
155:                        // may happen for pseudo IDL
156:                        logger.warn("Caught Exception", e);
157:                    } catch (Exception e) {
158:                        logger.error("Caught Exception", e);
159:                    }
160:                    return null;
161:                } else if (c.getName().endsWith("Helper")) {
162:                    try {
163:                        org.omg.CORBA.TypeCode tc = (org.omg.CORBA.TypeCode) c
164:                                .getDeclaredMethod("type", (Class[]) null)
165:                                .invoke(null, (java.lang.Object[]) null);
166:                        if (tc.kind() == org.omg.CORBA.TCKind.tk_alias) {
167:                            return new AliasDef(tc, _defined_in, ir, logger,
168:                                    poa);
169:                        }
170:                    } catch (Exception e) {
171:                    }
172:                    return null;
173:                } else {
174:                    return null;
175:                }
176:            }
177:
178:            public static org.omg.CORBA.Contained createContainedReference(
179:                    Contained containedObject, Logger logger, POA poa) {
180:                if (containedObject == null) {
181:                    throw new INTF_REPOS(
182:                            "Precondition violated in Contained createContainedReference");
183:                }
184:
185:                org.omg.PortableServer.Servant servant = null;
186:
187:                switch (containedObject.def_kind().value()) {
188:                case org.omg.CORBA.DefinitionKind._dk_Interface:
189:                    servant = new org.omg.CORBA.InterfaceDefPOATie(
190:                            (org.omg.CORBA.InterfaceDefOperations) containedObject);
191:                    break;
192:                case org.omg.CORBA.DefinitionKind._dk_Exception:
193:                    servant = new org.omg.CORBA.ExceptionDefPOATie(
194:                            (org.omg.CORBA.ExceptionDefOperations) containedObject);
195:                    break;
196:                case org.omg.CORBA.DefinitionKind._dk_Struct:
197:                    servant = new org.omg.CORBA.StructDefPOATie(
198:                            (org.omg.CORBA.StructDefOperations) containedObject);
199:                    break;
200:                case org.omg.CORBA.DefinitionKind._dk_Enum:
201:                    servant = new org.omg.CORBA.EnumDefPOATie(
202:                            (org.omg.CORBA.EnumDefOperations) containedObject);
203:                    break;
204:                case org.omg.CORBA.DefinitionKind._dk_Union:
205:                    servant = new org.omg.CORBA.UnionDefPOATie(
206:                            (org.omg.CORBA.UnionDefOperations) containedObject);
207:                    break;
208:                case org.omg.CORBA.DefinitionKind._dk_Module:
209:                    servant = new org.omg.CORBA.ModuleDefPOATie(
210:                            (org.omg.CORBA.ModuleDefOperations) containedObject);
211:                    break;
212:                case org.omg.CORBA.DefinitionKind._dk_Alias:
213:                    servant = new org.omg.CORBA.AliasDefPOATie(
214:                            (org.omg.CORBA.AliasDefOperations) containedObject);
215:                    break;
216:                case org.omg.CORBA.DefinitionKind._dk_Constant:
217:                    servant = new org.omg.CORBA.ConstantDefPOATie(
218:                            (org.omg.CORBA.ConstantDefOperations) containedObject);
219:                    break;
220:                default:
221:                    logger
222:                            .warn("WARNING, createContainedReference returns null for dk "
223:                                    + containedObject.def_kind().value());
224:                    return null;
225:                }
226:
227:                try {
228:                    org.omg.CORBA.Contained containedRef = org.omg.CORBA.ContainedHelper
229:                            .narrow(poa.servant_to_reference(servant));
230:
231:                    containedObject.setReference(containedRef);
232:                    return containedRef;
233:                } catch (Exception e) {
234:                    logger.error("unexpected exception", e);
235:                    return null;
236:                }
237:            }
238:
239:            public java.lang.String id() {
240:                return id;
241:            }
242:
243:            public void id(java.lang.String a) {
244:                id = a;
245:            }
246:
247:            public java.lang.String name() {
248:                return name;
249:            }
250:
251:            public void name(java.lang.String a) {
252:                name = a;
253:            }
254:
255:            public java.lang.String version() {
256:                return version;
257:            }
258:
259:            public void version(java.lang.String a) {
260:                version = a;
261:            }
262:
263:            public org.omg.CORBA.Container defined_in() {
264:                return defined_in;
265:            }
266:
267:            public java.lang.String absolute_name() {
268:                return absolute_name;
269:            }
270:
271:            public org.omg.CORBA.Repository containing_repository() {
272:                return containing_repository;
273:            }
274:
275:            public abstract org.omg.CORBA.ContainedPackage.Description describe();
276:
277:            public void move(org.omg.CORBA.Container new_container,
278:                    java.lang.String new_name, java.lang.String new_version) {
279:                if (defined_in != null)
280:                    ; // remove this object
281:
282:                defined_in = new_container;
283:                version = new_version;
284:                name = new_name;
285:            }
286:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.