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


001:        /*
002:         *        JacORB - a free Java ORB
003:         *
004:         *   Copyright (C) 1999-2004 Gerald Brose
005:         *
006:         *   This library is free software; you can redistribute it and/or
007:         *   modify it under the terms of the GNU Library General Public
008:         *   License as published by the Free Software Foundation; either
009:         *   version 2 of the License, or (at your option) any later version.
010:         *
011:         *   This library is distributed in the hope that it will be useful,
012:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *   Library General Public License for more details.
015:         *
016:         *   You should have received a copy of the GNU Library General Public
017:         *   License along with this library; if not, write to the Free
018:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
019:         *
020:         */
021:        package org.jacorb.orb.portableInterceptor;
022:
023:        import java.util.Iterator;
024:        import java.util.List;
025:        import java.util.Map;
026:
027:        import org.jacorb.orb.MinorCodes;
028:        import org.jacorb.orb.ORB;
029:        import org.jacorb.orb.TaggedComponentList;
030:        import org.jacorb.poa.POA;
031:        import org.omg.CORBA.CompletionStatus;
032:        import org.omg.CORBA.Policy;
033:        import org.omg.ETF.Profile;
034:        import org.omg.IOP.TaggedComponent;
035:
036:        /**
037:         * This class represents the type of info object
038:         * that will be passed to the IORInterceptors. <br>
039:         * See PI Spec p.7-64f
040:         *
041:         * @author Nicolas Noffke
042:         * @version $Id: IORInfoImpl.java,v 1.14 2006/07/07 10:55:57 alphonse.bendt Exp $
043:         */
044:
045:        public class IORInfoImpl extends org.omg.CORBA.LocalObject implements 
046:                IORInfoExt {
047:            /**
048:             * Maps profile tags to component lists (Integer -> TaggedComponentList).
049:             */
050:            private final Map components;
051:            private final Map policy_overrides;
052:            private final ORB orb;
053:            private final POA poa;
054:            private final List _profiles;
055:
056:            public IORInfoImpl(ORB orb, POA poa, Map components,
057:                    Map policy_overrides, List profiles) {
058:                this .orb = orb;
059:                this .poa = poa;
060:                this .components = components;
061:                this .policy_overrides = policy_overrides;
062:                this ._profiles = profiles;
063:            }
064:
065:            /**
066:             * Adds component to all profiles.
067:             */
068:            public void add_ior_component(TaggedComponent component) {
069:                for (Iterator i = components.values().iterator(); i.hasNext();) {
070:                    TaggedComponentList list = (TaggedComponentList) i.next();
071:                    list.addComponent(component);
072:                }
073:            }
074:
075:            /**
076:             * Adds the component to the profile with the given tag.
077:             */
078:            public void add_ior_component_to_profile(TaggedComponent component,
079:                    int id) {
080:                TaggedComponentList list = (TaggedComponentList) components
081:                        .get(new Integer(id));
082:                if (list == null) {
083:                    throw new org.omg.CORBA.BAD_PARAM("unknown profile tag: "
084:                            + id, MinorCodes.NO_SUCH_PROFILE,
085:                            CompletionStatus.COMPLETED_MAYBE);
086:                }
087:
088:                list.addComponent(component);
089:            }
090:
091:            /**
092:             * @return a policy of the given type, or null,
093:             * if no policy of that type is present.
094:             */
095:            public Policy get_effective_policy(int type) {
096:                if (!orb.hasPolicyFactoryForType(type)) {
097:                    throw new org.omg.CORBA.INV_POLICY(
098:                            "No PolicyFactory for type " + type
099:                                    + " has been registered!",
100:                            MinorCodes.NO_SUCH_POLICY,
101:                            CompletionStatus.COMPLETED_MAYBE);
102:                }
103:
104:                Policy policy = null;
105:                if (policy_overrides != null) {
106:                    policy = (Policy) policy_overrides.get(new Integer(type));
107:                }
108:                return (policy != null) ? policy : poa.getPolicy(type);
109:            }
110:
111:            /**
112:             * This method adds a further profile to an IOR.
113:             * By using this method it is possible to append e.g. further IIOP
114:             * profiles. The added profile is marshalled after all profiles
115:             * already existing in profile list.
116:             * @param profile       the profile to add
117:             */
118:            public void add_profile(Profile profile) {
119:                if (_profiles != null) {
120:                    _profiles.add(profile);
121:                }
122:            }
123:
124:            /**
125:             * This method returns the number of profiles of the given type.
126:             * The returned value can be used to iterate over the existing
127:             * profiles of given type (get_profile()).
128:             * @param tag     profile tag, e.g. TAG_INTERNET_IOP.value
129:             * @return        number of profiles of given tag
130:             */
131:            public int get_number_of_profiles(int tag) {
132:                int retVal = 0;
133:                for (int i = 0; i < _profiles.size(); i++) {
134:                    Profile p = (Profile) _profiles.get(i);
135:                    if (p.tag() == tag) {
136:                        retVal++;
137:                    }
138:                }
139:                return retVal;
140:            }
141:
142:            /**
143:             * Returns the profile with the given tag at the given position.
144:             * Following rule must apply to parameter position:<p>
145:             * <code> 0 <= position < get_number_of_profiles(tag) </code><p>
146:             * @param tag        tag of profile, e.g. TAG_INTERNET_IOP.value
147:             * @param position   position in IOR
148:             * @return           profile
149:             * @exception       ArrayIndexOutOfBoundsException if position is
150:             *                   out of range
151:             */
152:            public org.omg.ETF.Profile get_profile(int tag, int position) {
153:                int cnt = position;
154:                Profile result = null;
155:                for (int i = 0; i < _profiles.size(); i++) {
156:                    Profile profile = (Profile) _profiles.get(i);
157:                    if (profile.tag() == tag && cnt == 0) {
158:                        result = profile;
159:                        break;
160:                    }
161:                    cnt--;
162:                }
163:
164:                if (result == null) {
165:                    throw new ArrayIndexOutOfBoundsException(
166:                            "no profile with tag=" + tag + " at position"
167:                                    + position);
168:                }
169:
170:                return result;
171:            }
172:
173:            /**
174:             * Returns the first profile with the given tag (position == 0).
175:             * If no profile with given tag exists, null is returned.
176:             * @param tag        tag of profile, e.g. TAG_INTERNET_IOP.value
177:             * @return           first profile or null if no profile with given
178:             *                   tag exists
179:             */
180:            public org.omg.ETF.Profile get_profile(int tag) {
181:                Profile result = null;
182:                for (int i = 0; i < _profiles.size(); i++) {
183:                    Profile profile = (Profile) _profiles.get(i);
184:                    if (profile.tag() == tag) {
185:                        result = profile;
186:                        break;
187:                    }
188:                }
189:                return result;
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.