org.omg.PortableServer

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 » 6.0 JDK Modules sun » omg » org.omg.PortableServer 
org.omg.PortableServer
Provides classes and interfaces for making the server side of your applications portable across multivendor ORBs.

In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI) servants inherit from the standard DynamicImplementation class, which inherits from the Servant class. The native Servant type is defined by the PortableServer module for the POA. In Java, the Servant type is mapped to the Java org.omg.PortableServer.Servant class. It serves as the base class for all POA servant implementations and provides a number of methods that may be invoked by the application programmer, as well as methods which are invoked by the POA itself and may be overridden by the user to control aspects of servant behavior.

Package Specification

For a precise list of supported sections of official OMG specifications with which the Java[tm] Platform, Standard Edition 6 complies, see Official Specifications for CORBA support in Java[tm] SE 6.

POA-related Interfaces

The PortableServer module defines the following POA-related interfaces:

  • POA
  • POAManager
  • ServantManager
  • ServantActivator
  • ServantLocator
  • AdapterActivator
  • ThreadPolicy
  • LifespanPolicy
  • IdUniquenessPolicy
  • IdAssignmentPolicy
  • ImplicitActivationPolicy
  • ServantRetentionPolicy
  • RequestProcessingPolicy
  • Current

In addition, the POA defines the Servant native type.

Operations classes

Each of the interfaces listed above has an associated Operations interface. The Operations interface is generated by the idlj compiler and contains the method signatures for methods defined in its associated interface. The Operations interface can be accessed by both the client and the server, while its associated interface can only be called by the client.

Value Classes

Classes ending in the suffix PolicyValue provide the values used for the create_POA call, which sets the policy for the POA. See the sample code below for a demonstration. PolicyValue files include the following:

  • IdAssignmentPolicyValue
  • IdUniquenessPolicyValue
  • ImplicitActivationPolicyValue
  • LifespanPolicyValue
  • RequestProcessingPolicyValue
  • ServantRetentionPolicyValue
  • ThreadPolicyValue

Helper Classes

Helper classes, which are generated for all user-defined types in an OMG IDL interface, supply static methods needed to manipulate those types. There is only one method in a helper class that an application programmer uses: the narrow method. Only Java interfaces mapped from IDL interfaces will have a helper class that includes a narrow method, so in the PortableServer package, only the following classes have a narrow method:

  • ForwardRequestHelper
  • ServantActivatorHelper
  • ServantLocatorHelper

POA Classes

POA classes are used to implement the ServantActivator or ServantLocator.

Exceptions

The ForwardRequest exception indicates to the ORB that it is responsible for delivering the current request and subsequent ForwardRequest requests to the object denoted in the forward_reference member of the exception.

Interfaces Implemented by the Application Programmer

Most of what PortableServer 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:

  • AdapterActivator

    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 find_POA is called with an activate parameter value of TRUE. 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.

  • ServantLocator

    When the POA has the NON_RETAIN policy, it uses servant managers that are ServantLocators.

  • ServantActivator

    When the POA has the RETAIN policy, it uses servant managers that are ServantActivators.

Package org.omg.PortableServer.ServantLocatorPackage

This package supplies a CookieHolder class for passing the Cookie type as an out parameter. The CookieHolder class follows exactly the same pattern as the other holder classes for basic types.

Related Documentation

For an overview of Java IDL, please see:

  • Java IDL home page.

    Example Code

    Example Server Code

    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.rmi.PortableRemoteObject ;
    import com.sun.corba.se.impl.poa.POAORB;
    import org.omg.PortableServer.*;
    import java.util.*;
    import org.omg.CORBA.*;
    import javax.rmi.CORBA.Stub;
    import javax.rmi.CORBA.Util;
    
    
    
    public class HelloServer {
        public HelloServer(String[] args) {
            try {
                Properties p = System.getProperties();
             //   p.put("org.omg.CORBA.ORBClass", "com.sun.corba.ee.internal.POA.POAORB");
                ORB orb = ORB.init( args, p );
    
                POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
    
                Policy[] tpolicy = new Policy[3];
                tpolicy[0] = rootPOA.create_lifespan_policy(
                    LifespanPolicyValue.TRANSIENT );
                tpolicy[1] = rootPOA.create_request_processing_policy(
                    RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY );
                tpolicy[2] = rootPOA.create_servant_retention_policy(
                    ServantRetentionPolicyValue.RETAIN);
                POA tpoa = rootPOA.create_POA("MyTransientPOA", null, tpolicy);
    
    
                String  ObjectId = "MyObjectId";
                byte[] oid = ObjectId.getBytes();
    
                org.omg.CORBA.Object obj = tpoa.create_reference_with_id(oid,
                    new _HelloImpl_Tie()._all_interfaces(tpoa, oid)[0]);
                HelloInterface helloRef = (HelloInterface)PortableRemoteObject.narrow(
                    obj, HelloInterface.class );
    
                Context initialNamingContext = new InitialContext();
                initialNamingContext.rebind("HelloService", helloRef);
                System.out.println("Hello Server: Ready...");
                orb.run();
             } catch (Exception e) {
                System.out.println("Trouble: " + e);
                e.printStackTrace();
             } 
         }
    
    
         public static void main(String args[]) {
             new HelloServer( args );
         }
    }
    
    
    

    @since 1.4
    @serial exclude

  • Java Source File NameTypeComment
    CurrentHelper.javaClass The PortableServer::Current interface, derived from CORBA::Current, provides method implementations with access to the identity of the object on which the method was invoked.
    DynamicImplementation.javaClass Allows dynamic handling of object invocations.
    POAHelper.javaClass A POA object manages the implementation of a collection of objects.
    Servant.javaClass Defines the native Servant type.
    www.java2java.com | Contact Us
    Copyright 2009 - 12 Demo Source and Support. All rights reserved.
    All other trademarks are property of their respective owners.