POAPolicyMediator.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package com.sun.corba.se.impl.oa.poa ;
27
28import org.omg.PortableServer.Servant ;
29import org.omg.PortableServer.ServantManager ;
30import org.omg.PortableServer.ForwardRequest ;
31
32import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
33import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
34import org.omg.PortableServer.POAPackage.ServantNotActive ;
35import org.omg.PortableServer.POAPackage.NoServant ;
36import org.omg.PortableServer.POAPackage.WrongPolicy ;
37import org.omg.PortableServer.POAPackage.ObjectNotActive ;
38
39/** POAPolicyMediator defines an interface to which the POA delegates all
40 * policy specific operations.  This permits code paths for different
41 * policies to be optimized by creating the correct code at POA creation
42 * time.  Also note that as much as possible, this interface does not
43 * do any concurrency control, except as noted.  The POA is responsible
44 * for concurrency control.
45 */
46public interface POAPolicyMediator {
47    /** Return the policies object that was used to create this
48    * POAPolicyMediator.
49    */
50    Policies getPolicies() ;
51
52    /** Return the subcontract ID to use in the IIOP profile in IORs
53    * created by this POAPolicyMediator's POA.  This is initialized
54    * according to the policies and the POA used to construct this
55    * POAPolicyMediator in the POAPolicyMediatorFactory.
56    */
57    int getScid() ;
58
59    /** Return the server ID to use in the IIOP profile in IORs
60    * created by this POAPolicyMediator's POA.  This is initialized
61    * according to the policies and the POA used to construct this
62    * POAPolicyMediator in the POAPolicyMediatorFactory.
63    */
64    int getServerId() ;
65
66    /** Get the servant to use for an invocation with the
67    * given id and operation.
68    * @param id the object ID for which we are requesting a servant
69    * @param operation the name of the operation to be performed on
70    * the servant
71    * @return the resulting Servant.
72    */
73    java.lang.Object getInvocationServant( byte[] id,
74        String operation ) throws ForwardRequest ;
75
76    /** Release a servant that was obtained from getInvocationServant.
77    */
78    void returnServant() ;
79
80    /** Etherealize all servants associated with this POAPolicyMediator.
81    * Does nothing if the retention policy is non-retain.
82    */
83    void etherealizeAll() ;
84
85    /** Delete everything in the active object map.
86    */
87    void clearAOM() ;
88
89    /** Return the servant manager.  Will throw WrongPolicy
90    * if the request processing policy is not USE_SERVANT_MANAGER.
91    */
92    ServantManager getServantManager() throws WrongPolicy ;
93
94    /** Set the servant manager.  Will throw WrongPolicy
95    * if the request processing policy is not USE_SERVANT_MANAGER.
96    */
97    void setServantManager( ServantManager servantManager ) throws WrongPolicy ;
98
99    /** Return the default servant.   Will throw WrongPolicy
100    * if the request processing policy is not USE_DEFAULT_SERVANT.
101    */
102    Servant getDefaultServant() throws NoServant, WrongPolicy ;
103
104    /** Set the default servant.   Will throw WrongPolicy
105    * if the request processing policy is not USE_DEFAULT_SERVANT.
106    */
107    void setDefaultServant( Servant servant ) throws WrongPolicy ;
108
109    void activateObject( byte[] id, Servant servant )
110        throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ;
111
112    /** Deactivate the object that is associated with the given id.
113    * Returns the servant for id.
114    */
115    Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ;
116
117    /** Allocate a new, unique system ID.  Requires the ID assignment policy
118    * to be SYSTEM.
119    */
120    byte[] newSystemId() throws WrongPolicy ;
121
122    byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ;
123
124    Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ;
125}
126