1. /*
  2. * @(#)ActivationSystem.java 1.18 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 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.18, 12/19/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 a group for the specified
  95. * <code>id</code> is already active and that group is not equal
  96. * to the specified <code>group</code> or that group has a different
  97. * <code>incarnation</code> than the specified <code>group</code>
  98. * @exception RemoteException if remote call fails
  99. * @since 1.2
  100. */
  101. public ActivationMonitor activeGroup(ActivationGroupID id,
  102. ActivationInstantiator group,
  103. long incarnation)
  104. throws UnknownGroupException, ActivationException, RemoteException;
  105. /**
  106. * Remove the activation group. An activation group makes this call back
  107. * to inform the activator that the group should be removed (destroyed).
  108. * If this call completes successfully, objects can no longer be
  109. * registered or activated within the group. All information of the
  110. * group and its associated objects is removed from the system.
  111. *
  112. * @param id the activation group's identifier
  113. * @exception ActivationException if unregister fails (e.g., database
  114. * update failure, etc).
  115. * @exception UnknownGroupException if group is not registered
  116. * @exception RemoteException if remote call fails
  117. * @since 1.2
  118. */
  119. public void unregisterGroup(ActivationGroupID id)
  120. throws ActivationException, UnknownGroupException, RemoteException;
  121. /**
  122. * Shutdown the activation system. Destroys all groups spawned by
  123. * the activation daemon and exits the activation daemon.
  124. * @exception RemoteException if failed to contact/shutdown the activation
  125. * daemon
  126. * @since 1.2
  127. */
  128. public void shutdown() throws RemoteException;
  129. /**
  130. * Set the activation descriptor, <code>desc</code> for the object with
  131. * the activation identifier, <code>id</code>. The change will take
  132. * effect upon subsequent activation of the object.
  133. *
  134. * @param id the activation identifier for the activatable object
  135. * @param desc the activation descriptor for the activatable object
  136. * @exception UnknownGroupException the group associated with
  137. * <code>desc</code> is not a registered group
  138. * @exception UnknownObjectException the activation <code>id</code>
  139. * is not registered
  140. * @exception ActivationException for general failure (e.g., unable
  141. * to update log)
  142. * @exception RemoteException if remote call fails
  143. * @return the previous value of the activation descriptor
  144. * @see #getActivationDesc
  145. * @since 1.2
  146. */
  147. public ActivationDesc setActivationDesc(ActivationID id,
  148. ActivationDesc desc)
  149. throws ActivationException, UnknownObjectException,
  150. UnknownGroupException, RemoteException;
  151. /**
  152. * Set the activation group descriptor, <code>desc</code> for the object
  153. * with the activation group identifier, <code>id</code>. The change will
  154. * take effect upon subsequent activation of the group.
  155. *
  156. * @param id the activation group identifier for the activation group
  157. * @param desc the activation group descriptor for the activation group
  158. * @exception UnknownGroupException the group associated with
  159. * <code>id</code> is not a registered group
  160. * @exception ActivationException for general failure (e.g., unable
  161. * to update log)
  162. * @exception RemoteException if remote call fails
  163. * @return the previous value of the activation group descriptor
  164. * @see #getActivationGroupDesc
  165. * @since 1.2
  166. */
  167. public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID id,
  168. ActivationGroupDesc desc)
  169. throws ActivationException, UnknownGroupException, RemoteException;
  170. /**
  171. * Returns the activation descriptor, for the object with the activation
  172. * identifier, <code>id</code>.
  173. *
  174. * @param id the activation identifier for the activatable object
  175. * @exception UnknownObjectException if <code>id</code> is not registered
  176. * @exception ActivationException for general failure
  177. * @exception RemoteException if remote call fails
  178. * @return the activation descriptor
  179. * @see #setActivationDesc
  180. * @since 1.2
  181. */
  182. public ActivationDesc getActivationDesc(ActivationID id)
  183. throws ActivationException, UnknownObjectException, RemoteException;
  184. /**
  185. * Returns the activation group descriptor, for the group
  186. * with the activation group identifier, <code>id</code>.
  187. *
  188. * @param id the activation group identifier for the group
  189. * @exception UnknownGroupException if <code>id</code> is not registered
  190. * @exception ActivationException for general failure
  191. * @exception RemoteException if remote call fails
  192. * @return the activation group descriptor
  193. * @see #setActivationGroupDesc
  194. * @since 1.2
  195. */
  196. public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID id)
  197. throws ActivationException, UnknownGroupException, RemoteException;
  198. }