1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <html>
3 <head>
4 <!--
5
6 Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
7 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8
9 This code is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 only, as
11 published by the Free Software Foundation. Oracle designates this
12 particular file as subject to the "Classpath" exception as provided
13 by Oracle in the LICENSE file that accompanied this code.
14
15 This code is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 version 2 for more details (a copy is included in the LICENSE file that
19 accompanied this code).
20
21 You should have received a copy of the GNU General Public License version
22 2 along with this work; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26 or visit www.oracle.com if you need additional information or have any
35 portable across multivendor ORBs.
36
37 <P>In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI)
38 servants inherit from the standard <TT>DynamicImplementation</TT> class, which
39 inherits from the <TT>Servant</TT> class. The native <TT>Servant</TT> type is
40 defined by the <TT>PortableServer</TT> module for the POA. In Java, the
41 <TT>Servant</TT> type is mapped to the Java
42 <TT>org.omg.PortableServer.Servant</TT> class.
43 It serves as the base class for all POA servant
44 implementations and provides a number of methods that may
45 be invoked by the application programmer, as well as methods
46 which are invoked by the POA itself and may be overridden by
47 the user to control aspects of servant behavior.
48
49 <H2>Package Specification</H2>
50
51 <P>For a precise list of supported sections of official OMG specifications with which
52 the Java[tm] Platform, Standard Edition 6 complies, see <A
53 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
54 support in Java[tm] SE 6</A>.
55 <p>
56
57 <H2>POA-related Interfaces</H2>
58
59 <P>The <TT>PortableServer</TT> module defines the following POA-related interfaces:
60 <P>
61 <UL>
62 <LI><TT>POA</TT>
63 <LI><TT>POAManager</TT>
64 <LI><TT>ServantManager</TT>
65 <LI><TT>ServantActivator</TT>
66 <LI><TT>ServantLocator</TT>
67 <LI><TT>AdapterActivator</TT>
68 <LI><TT>ThreadPolicy</TT>
69 <LI><TT>LifespanPolicy</TT>
70 <LI><TT>IdUniquenessPolicy</TT>
71 <LI><TT>IdAssignmentPolicy</TT>
72 <LI><TT>ImplicitActivationPolicy</TT>
73 <LI><TT>ServantRetentionPolicy</TT>
74 <LI><TT>RequestProcessingPolicy</TT>
75 <LI><TT>Current</TT>
76 </UL>
77
78 <P>In addition, the POA defines the <TT>Servant</TT> native type.
79
80 <H3>Operations classes</H3>
81
82 <P>Each of the interfaces listed above has an associated <code>Operations</code> interface. The <code>Operations</code> interface is generated by the <code>idlj</code> compiler and contains the method signatures for methods defined in its associated interface. The <code>Operations</code> interface can be accessed by both the client and the server, while its associated interface can only be called by the client.
83
84 <H3>Value Classes</H3>
85
86 Classes ending in the suffix <code>PolicyValue</code> provide the values used for the <code>create_POA</code> call, which sets the policy for the POA. See the <a href="#sampleserver">sample code</a> below for a demonstration. <code>PolicyValue</code> files include the following:
87 <P>
88 <UL>
89 <LI><code>IdAssignmentPolicyValue</code>
90 <LI><code>IdUniquenessPolicyValue</code>
91 <LI><code>ImplicitActivationPolicyValue</code>
92 <LI><code>LifespanPolicyValue</code>
93 <LI><code>RequestProcessingPolicyValue</code>
94 <LI><code>ServantRetentionPolicyValue</code>
95 <LI><code>ThreadPolicyValue</code>
96 </UL>
97
98 <H3>Helper Classes</H3>
99
100 <P>Helper classes, which are generated for all user-defined types in an OMG IDL
101 interface, supply static methods needed to manipulate those types. There is only one method in a helper class that an application programmer uses: the <code>narrow</code> method. Only Java interfaces mapped from IDL interfaces will have a helper class that includes a <code>narrow</code> method, so in the <code>PortableServer</code> package, only the following classes have a <code>narrow</code> method:
102 <P>
103 <UL>
104 <LI><code>ForwardRequestHelper</code>
105 <LI><code>ServantActivatorHelper</code>
106 <LI><code>ServantLocatorHelper</code>
107 </UL>
108
109 <H3>POA Classes</H3>
110
111 <P>POA classes are used to implement the <code>ServantActivator</code> or <code>ServantLocator</code>.
112
113 <H3>Exceptions</H3>
114
115 <P>The <code>ForwardRequest</code> exception indicates to the ORB
116 that it is responsible for delivering the current request and subsequent <code>ForwardRequest</code> requests to the object denoted in the
117 <code>forward_reference</code> member of the exception.
118
119 <H3>Interfaces Implemented by the Application Programmer</H3>
120
121 <P>Most of what <code>PortableServer</code> does is transparent to the user. The result is that programmers will use only a few of the interfaces mentioned above. The remaining interfaces will be provided by the ORB implementation. The interfaces of interest to application programmers are the following:
122 <P>
123 <ul>
124 <LI><code>AdapterActivator</code>
125 <P>Adapter activators are associated with POAs. An adapter activator supplies a POA with the ability to create child POAs on demand, as a side-effect of receiving a request that names the child POA (or one of its children), or when <code>find_POA</code> is called with an activate parameter value of <code>TRUE</code>. An application server that creates all its needed POAs at the beginning of execution does not need to use or provide an adapter activator; it is necessary only for the case in which POAs need to be created during request processing.
126 <P>
127 <LI><code>ServantLocator</code>
128 <P>When the POA has the <code>NON_RETAIN</code> policy, it uses servant managers that are <code>ServantLocator</code>s.
129 <P>
130 <LI><code>ServantActivator</code>
131 <P>When the POA has the <code>RETAIN</code> policy, it uses servant managers that are <code>ServantActivator</code>s.
132 </ul>
133
134
135 <H2>Package <TT>org.omg.PortableServer.ServantLocatorPackage</TT></H2>
136
137 <P>This package supplies a <TT>CookieHolder</TT> class for passing
138 the <TT>Cookie</TT> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
139 follows exactly the same pattern as the other holder classes for basic types.
140
141 <H2>Related Documentation</H2>
142
143 <P>For an overview of Java IDL, please see:
144 <P>
145 <LI><A HREF="../../../../technotes/guides/idl/index.html">Java IDL home page</A>.
146
147 <H2>Example Code</H2>
148 <a name="sampleserver"></a>
149 <H3>Example Server Code</H3>
150 <P>
151 <PRE>
152 import javax.naming.InitialContext;
153 import javax.naming.Context;
154 import javax.rmi.PortableRemoteObject ;
155 import com.sun.corba.se.impl.poa.POAORB;
156 import org.omg.PortableServer.*;
157 import java.util.*;
158 import org.omg.CORBA.*;
159 import javax.rmi.CORBA.Stub;
160 import javax.rmi.CORBA.Util;
161
162
163
164 public class HelloServer {
165 public HelloServer(String[] args) {
166 try {
167 Properties p = System.getProperties();
168 // p.put("org.omg.CORBA.ORBClass", "com.sun.corba.ee.internal.POA.POAORB");
169 ORB orb = ORB.init( args, p );
170
190
191 Context initialNamingContext = new InitialContext();
192 initialNamingContext.rebind("HelloService", helloRef);
193 System.out.println("Hello Server: Ready...");
194 orb.run();
195 } catch (Exception e) {
196 System.out.println("Trouble: " + e);
197 e.printStackTrace();
198 }
199 }
200
201
202 public static void main(String args[]) {
203 new HelloServer( args );
204 }
205 }
206
207
208 </PRE>
209
210
211
212 <P>
213
214
215 @since 1.4
216 <br>
217 @serial exclude
218 </body>
219 </html>
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <html>
3 <head>
4 <!--
5
6 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
7 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8
9 This code is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 only, as
11 published by the Free Software Foundation. Oracle designates this
12 particular file as subject to the "Classpath" exception as provided
13 by Oracle in the LICENSE file that accompanied this code.
14
15 This code is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 version 2 for more details (a copy is included in the LICENSE file that
19 accompanied this code).
20
21 You should have received a copy of the GNU General Public License version
22 2 along with this work; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24
25 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
26 or visit www.oracle.com if you need additional information or have any
35 portable across multivendor ORBs.
36
37 <P>In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI)
38 servants inherit from the standard <TT>DynamicImplementation</TT> class, which
39 inherits from the <TT>Servant</TT> class. The native <TT>Servant</TT> type is
40 defined by the <TT>PortableServer</TT> module for the POA. In Java, the
41 <TT>Servant</TT> type is mapped to the Java
42 <TT>org.omg.PortableServer.Servant</TT> class.
43 It serves as the base class for all POA servant
44 implementations and provides a number of methods that may
45 be invoked by the application programmer, as well as methods
46 which are invoked by the POA itself and may be overridden by
47 the user to control aspects of servant behavior.
48
49 <H2>Package Specification</H2>
50
51 <P>For a precise list of supported sections of official OMG specifications with which
52 the Java[tm] Platform, Standard Edition 6 complies, see <A
53 HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
54 support in Java[tm] SE 6</A>.
55
56 <H2>POA-related Interfaces</H2>
57
58 <P>The <TT>PortableServer</TT> module defines the following POA-related interfaces:
59 <UL>
60 <LI><TT>POA</TT>
61 <LI><TT>POAManager</TT>
62 <LI><TT>ServantManager</TT>
63 <LI><TT>ServantActivator</TT>
64 <LI><TT>ServantLocator</TT>
65 <LI><TT>AdapterActivator</TT>
66 <LI><TT>ThreadPolicy</TT>
67 <LI><TT>LifespanPolicy</TT>
68 <LI><TT>IdUniquenessPolicy</TT>
69 <LI><TT>IdAssignmentPolicy</TT>
70 <LI><TT>ImplicitActivationPolicy</TT>
71 <LI><TT>ServantRetentionPolicy</TT>
72 <LI><TT>RequestProcessingPolicy</TT>
73 <LI><TT>Current</TT>
74 </UL>
75
76 <P>In addition, the POA defines the <TT>Servant</TT> native type.
77
78 <H3>Operations classes</H3>
79
80 <P>Each of the interfaces listed above has an associated <code>Operations</code> interface.
81 The <code>Operations</code> interface is generated by the <code>idlj</code> compiler and
82 contains the method signatures for methods defined in its associated interface.
83 The <code>Operations</code> interface can be accessed by both the client and the server,
84 while its associated interface can only be called by the client.
85
86 <H3>Value Classes</H3>
87
88 Classes ending in the suffix <code>PolicyValue</code> provide the values used
89 for the <code>create_POA</code> call, which sets the policy for the POA. See
90 the <a href="#sampleserver">sample code</a> below for a demonstration.
91 <code>PolicyValue</code> files include the following:
92 <UL>
93 <LI><code>IdAssignmentPolicyValue</code>
94 <LI><code>IdUniquenessPolicyValue</code>
95 <LI><code>ImplicitActivationPolicyValue</code>
96 <LI><code>LifespanPolicyValue</code>
97 <LI><code>RequestProcessingPolicyValue</code>
98 <LI><code>ServantRetentionPolicyValue</code>
99 <LI><code>ThreadPolicyValue</code>
100 </UL>
101
102 <H3>Helper Classes</H3>
103
104 <P>Helper classes, which are generated for all user-defined types in an OMG IDL
105 interface, supply static methods needed to manipulate those types.
106 There is only one method in a helper class that an application programmer uses:
107 the <code>narrow</code> method. Only Java interfaces mapped from IDL interfaces
108 will have a helper class that includes a <code>narrow</code> method, so in
109 the <code>PortableServer</code> package, only the following classes have a <code>narrow</code> method:
110 <UL>
111 <LI><code>ForwardRequestHelper</code>
112 <LI><code>ServantActivatorHelper</code>
113 <LI><code>ServantLocatorHelper</code>
114 </UL>
115
116 <H3>POA Classes</H3>
117
118 <P>POA classes are used to implement the <code>ServantActivator</code> or <code>ServantLocator</code>.
119
120 <H3>Exceptions</H3>
121
122 <P>The <code>ForwardRequest</code> exception indicates to the ORB
123 that it is responsible for delivering the current request and
124 subsequent <code>ForwardRequest</code> requests to the object denoted in the
125 <code>forward_reference</code> member of the exception.
126
127 <H3>Interfaces Implemented by the Application Programmer</H3>
128
129 <P>Most of what <code>PortableServer</code> does is transparent to the user.
130 The result is that programmers will use only a few of the interfaces mentioned above.
131 The remaining interfaces will be provided by the ORB implementation.
132 The interfaces of interest to application programmers are the following:
133 <ul>
134 <LI><code>AdapterActivator</code>
135 <P>Adapter activators are associated with POAs.
136 An adapter activator supplies a POA with the ability to create child POAs on demand,
137 as a side-effect of receiving a request that names the child POA (or one of its children),
138 or when <code>find_POA</code> is called with an activate parameter value of <code>TRUE</code>.
139 An application server that creates all its needed POAs at the beginning of execution
140 does not need to use or provide an adapter activator; it is necessary
141 only for the case in which POAs need to be created during request processing.
142 <LI><code>ServantLocator</code>
143 <P>When the POA has the <code>NON_RETAIN</code> policy,
144 it uses servant managers that are <code>ServantLocator</code>s.
145 <LI><code>ServantActivator</code>
146 <P>When the POA has the <code>RETAIN</code> policy,
147 it uses servant managers that are <code>ServantActivator</code>s.
148 </ul>
149
150
151 <H2>Package <TT>org.omg.PortableServer.ServantLocatorPackage</TT></H2>
152
153 <P>This package supplies a <TT>CookieHolder</TT> class for passing
154 the <TT>Cookie</TT> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
155 follows exactly the same pattern as the other holder classes for basic types.
156
157 <H2>Related Documentation</H2>
158
159 <P>For an overview of Java IDL, please see:
160 <A HREF="../../../../technotes/guides/idl/index.html">Java IDL home page</A>.
161
162 <H2>Example Code</H2>
163 <a name="sampleserver"></a>
164 <H3>Example Server Code</H3>
165 <PRE>
166 import javax.naming.InitialContext;
167 import javax.naming.Context;
168 import javax.rmi.PortableRemoteObject ;
169 import com.sun.corba.se.impl.poa.POAORB;
170 import org.omg.PortableServer.*;
171 import java.util.*;
172 import org.omg.CORBA.*;
173 import javax.rmi.CORBA.Stub;
174 import javax.rmi.CORBA.Util;
175
176
177
178 public class HelloServer {
179 public HelloServer(String[] args) {
180 try {
181 Properties p = System.getProperties();
182 // p.put("org.omg.CORBA.ORBClass", "com.sun.corba.ee.internal.POA.POAORB");
183 ORB orb = ORB.init( args, p );
184
204
205 Context initialNamingContext = new InitialContext();
206 initialNamingContext.rebind("HelloService", helloRef);
207 System.out.println("Hello Server: Ready...");
208 orb.run();
209 } catch (Exception e) {
210 System.out.println("Trouble: " + e);
211 e.printStackTrace();
212 }
213 }
214
215
216 public static void main(String args[]) {
217 new HelloServer( args );
218 }
219 }
220
221
222 </PRE>
223
224
225
226 @since 1.4
227 <br>
228 @serial exclude
229 </body>
230 </html>
|