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