1. /*
  2. * @(#)POAPolicyMediator.java 1.23 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.oa.poa ;
  8. import org.omg.PortableServer.Servant ;
  9. import org.omg.PortableServer.ServantManager ;
  10. import org.omg.PortableServer.ForwardRequest ;
  11. import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
  12. import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
  13. import org.omg.PortableServer.POAPackage.ServantNotActive ;
  14. import org.omg.PortableServer.POAPackage.NoServant ;
  15. import org.omg.PortableServer.POAPackage.WrongPolicy ;
  16. import org.omg.PortableServer.POAPackage.ObjectNotActive ;
  17. /** POAPolicyMediator defines an interface to which the POA delegates all
  18. * policy specific operations. This permits code paths for different
  19. * policies to be optimized by creating the correct code at POA creation
  20. * time. Also note that as much as possible, this interface does not
  21. * do any concurrency control, except as noted. The POA is responsible
  22. * for concurrency control.
  23. */
  24. public interface POAPolicyMediator {
  25. /** Return the policies object that was used to create this
  26. * POAPolicyMediator.
  27. */
  28. Policies getPolicies() ;
  29. /** Return the subcontract ID to use in the IIOP profile in IORs
  30. * created by this POAPolicyMediator's POA. This is initialized
  31. * according to the policies and the POA used to construct this
  32. * POAPolicyMediator in the POAPolicyMediatorFactory.
  33. */
  34. int getScid() ;
  35. /** Return the server ID to use in the IIOP profile in IORs
  36. * created by this POAPolicyMediator's POA. This is initialized
  37. * according to the policies and the POA used to construct this
  38. * POAPolicyMediator in the POAPolicyMediatorFactory.
  39. */
  40. int getServerId() ;
  41. /** Get the servant to use for an invocation with the
  42. * given id and operation.
  43. * @param id the object ID for which we are requesting a servant
  44. * @param operation the name of the operation to be performed on
  45. * the servant
  46. * @return the resulting Servant.
  47. */
  48. java.lang.Object getInvocationServant( byte[] id,
  49. String operation ) throws ForwardRequest ;
  50. /** Release a servant that was obtained from getInvocationServant.
  51. */
  52. void returnServant() ;
  53. /** Etherealize all servants associated with this POAPolicyMediator.
  54. * Does nothing if the retention policy is non-retain.
  55. */
  56. void etherealizeAll() ;
  57. /** Delete everything in the active object map.
  58. */
  59. void clearAOM() ;
  60. /** Return the servant manager. Will throw WrongPolicy
  61. * if the request processing policy is not USE_SERVANT_MANAGER.
  62. */
  63. ServantManager getServantManager() throws WrongPolicy ;
  64. /** Set the servant manager. Will throw WrongPolicy
  65. * if the request processing policy is not USE_SERVANT_MANAGER.
  66. */
  67. void setServantManager( ServantManager servantManager ) throws WrongPolicy ;
  68. /** Return the default servant. Will throw WrongPolicy
  69. * if the request processing policy is not USE_DEFAULT_SERVANT.
  70. */
  71. Servant getDefaultServant() throws NoServant, WrongPolicy ;
  72. /** Set the default servant. Will throw WrongPolicy
  73. * if the request processing policy is not USE_DEFAULT_SERVANT.
  74. */
  75. void setDefaultServant( Servant servant ) throws WrongPolicy ;
  76. void activateObject( byte[] id, Servant servant )
  77. throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ;
  78. /** Deactivate the object that is associated with the given id.
  79. * Returns the servant for id.
  80. */
  81. Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ;
  82. /** Allocate a new, unique system ID. Requires the ID assignment policy
  83. * to be SYSTEM.
  84. */
  85. byte[] newSystemId() throws WrongPolicy ;
  86. byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ;
  87. Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ;
  88. }