1. /*
  2. * @(#)ActivationSystem.java 1.16 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.rmi.activation;
  8. import java.rmi.Remote;
  9. import java.rmi.RemoteException;
  10. import java.rmi.activation.UnknownGroupException;
  11. import java.rmi.activation.UnknownObjectException;
  12. /**
  13. * The <code>ActivationSystem</code> provides a means for registering
  14. * groups and "activatable" objects to be activated within those groups.
  15. * The <code>ActivationSystem</code> works closely with the
  16. * <code>Activator</code>, which activates objects registered via the
  17. * <code>ActivationSystem</code>, and the <code>ActivationMonitor</code>,
  18. * which obtains information about active and inactive objects,
  19. * and inactive groups.
  20. *
  21. * @author Ann Wollrath
  22. * @version 1.16, 01/23/03
  23. * @see Activator
  24. * @see ActivationMonitor
  25. * @since 1.2
  26. */
  27. public interface ActivationSystem extends Remote {
  28. /** The port to lookup the activation system. */
  29. public static final int SYSTEM_PORT = 1098;
  30. /**
  31. * The <code>registerObject</code> method is used to register an
  32. * activation descriptor, <code>desc</code>, and obtain an
  33. * activation identifier for a activatable remote object. The
  34. * <code>ActivationSystem</code> creates an
  35. * <code>ActivationID</code> (a activation identifier) for the
  36. * object specified by the descriptor, <code>desc</code>, and
  37. * records, in stable storage, the activation descriptor and its
  38. * associated identifier for later use. When the <code>Activator</code>
  39. * receives an <code>activate</code> request for a specific identifier, it
  40. * looks up the activation descriptor (registered previously) for
  41. * the specified identifier and uses that information to activate
  42. * the object. <p>
  43. *
  44. * @param desc the object's activation descriptor
  45. * @return the activation id that can be used to activate the object
  46. * @exception ActivationException if registration fails (e.g., database
  47. * update failure, etc).
  48. * @exception UnknownGroupException if group referred to in
  49. * <code>desc</code> is not registered with this system
  50. * @exception RemoteException if remote call fails
  51. * @since 1.2
  52. */
  53. public ActivationID registerObject(ActivationDesc desc)
  54. throws ActivationException, UnknownGroupException, RemoteException;
  55. /**
  56. * Remove the activation id and associated descriptor previously
  57. * registered with the <code>ActivationSystem</code> the object
  58. * can no longer be activated via the object's activation id.
  59. *
  60. * @param id the object's activation id (from previous registration)
  61. * @exception ActivationException if unregister fails (e.g., database
  62. * update failure, etc).
  63. * @exception UnknownObjectException if object is unknown (not registered)
  64. * @exception RemoteException if remote call fails
  65. * @since 1.2
  66. */
  67. public void unregisterObject(ActivationID id)
  68. throws ActivationException, UnknownObjectException, RemoteException;
  69. /**
  70. * Register the activation group. An activation group must be
  71. * registered with the <code>ActivationSystem</code> before objects
  72. * can be registered within that group.
  73. *
  74. * @param desc the group's descriptor
  75. * @return an identifier for the group
  76. * @exception ActivationException if group registration fails
  77. * @exception RemoteException if remote call fails
  78. * @since 1.2
  79. */
  80. public ActivationGroupID registerGroup(ActivationGroupDesc desc)
  81. throws ActivationException, RemoteException;
  82. /**
  83. * Callback to inform activation system that group is now
  84. * active. This call is made internally by the
  85. * <code>ActivationGroup.createGroup</code> method to inform
  86. * the <code>ActivationSystem</code> that the group is now
  87. * active.
  88. *
  89. * @param id the activation group's identifier
  90. * @param group the group's instantiator
  91. * @param incarnation the group's incarnation number
  92. * @return monitor for activation group
  93. * @exception UnknownGroupException if group is not registered
  94. * @exception ActivationException if group is already active
  95. * @exception RemoteException if remote call fails
  96. * @since 1.2
  97. */
  98. public ActivationMonitor activeGroup(ActivationGroupID id,
  99. ActivationInstantiator group,
  100. long incarnation)
  101. throws UnknownGroupException, ActivationException, RemoteException;
  102. /**
  103. * Remove the activation group. An activation group makes this call back
  104. * to inform the activator that the group should be removed (destroyed).
  105. * If this call completes successfully, objects can no longer be
  106. * registered or activated within the group. All information of the
  107. * group and its associated objects is removed from the system.
  108. *
  109. * @param id the activation group's identifier
  110. * @exception ActivationException if unregister fails (e.g., database
  111. * update failure, etc).
  112. * @exception UnknownGroupException if group is not registered
  113. * @exception RemoteException if remote call fails
  114. * @since 1.2
  115. */
  116. public void unregisterGroup(ActivationGroupID id)
  117. throws ActivationException, UnknownGroupException, RemoteException;
  118. /**
  119. * Shutdown the activation system. Destroys all groups spawned by
  120. * the activation daemon and exits the activation daemon.
  121. * @exception RemoteException if failed to contact/shutdown the activation
  122. * daemon
  123. * @since 1.2
  124. */
  125. public void shutdown() throws RemoteException;
  126. /**
  127. * Set the activation descriptor, <code>desc</code> for the object with
  128. * the activation identifier, <code>id</code>. The change will take
  129. * effect upon subsequent activation of the object.
  130. *
  131. * @param id the activation identifier for the activatable object
  132. * @param desc the activation descriptor for the activatable object
  133. * @exception UnknownGroupException the group associated with
  134. * <code>desc</code> is not a registered group
  135. * @exception UnknownObjectException the activation <code>id</code>
  136. * is not registered
  137. * @exception ActivationException for general failure (e.g., unable
  138. * to update log)
  139. * @exception RemoteException if remote call fails
  140. * @return the previous value of the activation descriptor
  141. * @see #getActivationDesc
  142. * @since 1.2
  143. */
  144. public ActivationDesc setActivationDesc(ActivationID id,
  145. ActivationDesc desc)
  146. throws ActivationException, UnknownObjectException,
  147. UnknownGroupException, RemoteException;
  148. /**
  149. * Set the activation group descriptor, <code>desc</code> for the object
  150. * with the activation group identifier, <code>id</code>. The change will
  151. * take effect upon subsequent activation of the group.
  152. *
  153. * @param id the activation group identifier for the activation group
  154. * @param desc the activation group descriptor for the activation group
  155. * @exception UnknownGroupException the group associated with
  156. * <code>id</code> is not a registered group
  157. * @exception ActivationException for general failure (e.g., unable
  158. * to update log)
  159. * @exception RemoteException if remote call fails
  160. * @return the previous value of the activation group descriptor
  161. * @see #getActivationGroupDesc
  162. * @since 1.2
  163. */
  164. public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID id,
  165. ActivationGroupDesc desc)
  166. throws ActivationException, UnknownGroupException, RemoteException;
  167. /**
  168. * Returns the activation descriptor, for the object with the activation
  169. * identifier, <code>id</code>.
  170. *
  171. * @param id the activation identifier for the activatable object
  172. * @exception UnknownObjectException if <code>id</code> is not registered
  173. * @exception ActivationException for general failure
  174. * @exception RemoteException if remote call fails
  175. * @return the activation descriptor
  176. * @see #setActivationDesc
  177. * @since 1.2
  178. */
  179. public ActivationDesc getActivationDesc(ActivationID id)
  180. throws ActivationException, UnknownObjectException, RemoteException;
  181. /**
  182. * Returns the activation group descriptor, for the group
  183. * with the activation group identifier, <code>id</code>.
  184. *
  185. * @param id the activation group identifier for the group
  186. * @exception UnknownGroupException if <code>id</code> is not registered
  187. * @exception ActivationException for general failure
  188. * @exception RemoteException if remote call fails
  189. * @return the activation group descriptor
  190. * @see #setActivationGroupDesc
  191. * @since 1.2
  192. */
  193. public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID id)
  194. throws ActivationException, UnknownGroupException, RemoteException;
  195. }